OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Helper tool that is built and run during a build to pull strings from | 5 // Helper tool that is built and run during a build to pull strings from |
6 // the GRD files and generate the InfoPlist.strings files needed for | 6 // the GRD files and generate the InfoPlist.strings files needed for |
7 // Mac OS X app bundles. | 7 // Mac OS X app bundles. |
8 | 8 |
9 #import <Foundation/Foundation.h> | 9 #import <Foundation/Foundation.h> |
10 | 10 |
11 #include <stdio.h> | 11 #include <stdio.h> |
12 #include <unistd.h> | 12 #include <unistd.h> |
13 | 13 |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
16 #include "base/mac/scoped_nsautorelease_pool.h" | 16 #include "base/mac/scoped_nsautorelease_pool.h" |
17 #include "base/memory/scoped_ptr.h" | 17 #include "base/memory/scoped_ptr.h" |
18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
19 #include "base/strings/string_piece.h" | 19 #include "base/strings/string_piece.h" |
20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
21 #include "base/strings/string_util.h" | 21 #include "base/strings/string_util.h" |
22 #include "base/strings/sys_string_conversions.h" | 22 #include "base/strings/sys_string_conversions.h" |
23 #include "grit/chromium_strings.h" | 23 #include "chrome/grit/chromium_strings.h" |
24 #include "ui/base/resource/data_pack.h" | 24 #include "ui/base/resource/data_pack.h" |
25 | 25 |
26 namespace { | 26 namespace { |
27 | 27 |
28 NSString* ApplicationVersionString(const char* version_file_path) { | 28 NSString* ApplicationVersionString(const char* version_file_path) { |
29 NSError* error = nil; | 29 NSError* error = nil; |
30 NSString* path_string = [NSString stringWithUTF8String:version_file_path]; | 30 NSString* path_string = [NSString stringWithUTF8String:version_file_path]; |
31 NSString* version_file = | 31 NSString* version_file = |
32 [NSString stringWithContentsOfFile:path_string | 32 [NSString stringWithContentsOfFile:path_string |
33 encoding:NSUTF8StringEncoding | 33 encoding:NSUTF8StringEncoding |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 [output_path stringByAppendingPathComponent:@"InfoPlist.strings"]; | 328 [output_path stringByAppendingPathComponent:@"InfoPlist.strings"]; |
329 if (![strings_file_contents_utf8 writeToFile:output_path | 329 if (![strings_file_contents_utf8 writeToFile:output_path |
330 atomically:YES]) { | 330 atomically:YES]) { |
331 fprintf(stderr, "ERROR: Failed to write out '%s'\n", | 331 fprintf(stderr, "ERROR: Failed to write out '%s'\n", |
332 [output_path UTF8String]); | 332 [output_path UTF8String]); |
333 exit(1); | 333 exit(1); |
334 } | 334 } |
335 } | 335 } |
336 return 0; | 336 return 0; |
337 } | 337 } |
OLD | NEW |