OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/data_pack.h" | 14 #include "base/data_pack.h" |
15 #include "base/file_path.h" | 15 #include "base/file_path.h" |
16 #include "base/scoped_nsautorelease_pool.h" | 16 #include "base/mac/scoped_nsautorelease_pool.h" |
17 #include "base/scoped_ptr.h" | 17 #include "base/scoped_ptr.h" |
18 #include "base/string_piece.h" | 18 #include "base/string_piece.h" |
19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
20 #include "grit/chromium_strings.h" | 20 #include "grit/chromium_strings.h" |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 NSString* ApplicationVersionString(const char* version_file_path) { | 24 NSString* ApplicationVersionString(const char* version_file_path) { |
25 NSError* error = nil; | 25 NSError* error = nil; |
26 NSString* path_string = [NSString stringWithUTF8String:version_file_path]; | 26 NSString* path_string = [NSString stringWithUTF8String:version_file_path]; |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 return [[worker copy] autorelease]; | 127 return [[worker copy] autorelease]; |
128 } | 128 } |
129 | 129 |
130 // The valid types for the -t arg | 130 // The valid types for the -t arg |
131 const char* kAppType_Main = "main"; // Main app | 131 const char* kAppType_Main = "main"; // Main app |
132 const char* kAppType_Helper = "helper"; // Helper app | 132 const char* kAppType_Helper = "helper"; // Helper app |
133 | 133 |
134 } // namespace | 134 } // namespace |
135 | 135 |
136 int main(int argc, char* const argv[]) { | 136 int main(int argc, char* const argv[]) { |
137 base::ScopedNSAutoreleasePool autorelease_pool; | 137 base::mac::ScopedNSAutoreleasePool autorelease_pool; |
138 | 138 |
139 const char* version_file_path = NULL; | 139 const char* version_file_path = NULL; |
140 const char* grit_output_dir = NULL; | 140 const char* grit_output_dir = NULL; |
141 const char* branding_strings_name = NULL; | 141 const char* branding_strings_name = NULL; |
142 const char* output_dir = NULL; | 142 const char* output_dir = NULL; |
143 const char* app_type = kAppType_Main; | 143 const char* app_type = kAppType_Main; |
144 | 144 |
145 // Process the args | 145 // Process the args |
146 int ch; | 146 int ch; |
147 while ((ch = getopt(argc, argv, "t:v:g:b:o:")) != -1) { | 147 while ((ch = getopt(argc, argv, "t:v:g:b:o:")) != -1) { |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 [output_path stringByAppendingPathComponent:@"InfoPlist.strings"]; | 296 [output_path stringByAppendingPathComponent:@"InfoPlist.strings"]; |
297 if (![strings_file_contents_utf8 writeToFile:output_path | 297 if (![strings_file_contents_utf8 writeToFile:output_path |
298 atomically:YES]) { | 298 atomically:YES]) { |
299 fprintf(stderr, "ERROR: Failed to write out '%s'\n", | 299 fprintf(stderr, "ERROR: Failed to write out '%s'\n", |
300 [output_path UTF8String]); | 300 [output_path UTF8String]); |
301 exit(1); | 301 exit(1); |
302 } | 302 } |
303 } | 303 } |
304 return 0; | 304 return 0; |
305 } | 305 } |
OLD | NEW |