OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include <Cocoa/Cocoa.h> | 5 #include <Cocoa/Cocoa.h> |
6 #include <sys/param.h> | 6 #include <sys/param.h> |
7 | 7 |
8 #include "chrome/browser/importer/firefox_importer_utils.h" | 8 #include "chrome/browser/importer/firefox_importer_utils.h" |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
11 #include "base/mac/foundation_util.h" | 11 #include "base/mac/foundation_util.h" |
12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
13 | 13 |
14 base::FilePath GetProfilesINI() { | 14 base::FilePath GetProfilesINI() { |
15 base::FilePath app_data_path; | 15 base::FilePath app_data_path; |
16 if (!PathService::Get(base::DIR_APP_DATA, &app_data_path)) { | 16 if (!PathService::Get(base::DIR_APP_DATA, &app_data_path)) { |
17 return base::FilePath(); | 17 return base::FilePath(); |
18 } | 18 } |
19 base::FilePath ini_file = | 19 base::FilePath ini_file = |
20 app_data_path.Append("Firefox").Append("profiles.ini"); | 20 app_data_path.Append("Firefox").Append("profiles.ini"); |
21 if (!file_util::PathExists(ini_file)) { | 21 if (!base::PathExists(ini_file)) { |
22 return base::FilePath(); | 22 return base::FilePath(); |
23 } | 23 } |
24 return ini_file; | 24 return ini_file; |
25 } | 25 } |
26 | 26 |
27 base::FilePath GetFirefoxDylibPath() { | 27 base::FilePath GetFirefoxDylibPath() { |
28 CFURLRef appURL = nil; | 28 CFURLRef appURL = nil; |
29 if (LSFindApplicationForInfo(kLSUnknownCreator, | 29 if (LSFindApplicationForInfo(kLSUnknownCreator, |
30 CFSTR("org.mozilla.firefox"), | 30 CFSTR("org.mozilla.firefox"), |
31 NULL, | 31 NULL, |
32 NULL, | 32 NULL, |
33 &appURL) != noErr) { | 33 &appURL) != noErr) { |
34 return base::FilePath(); | 34 return base::FilePath(); |
35 } | 35 } |
36 NSBundle *ff_bundle = | 36 NSBundle *ff_bundle = |
37 [NSBundle bundleWithPath:[base::mac::CFToNSCast(appURL) path]]; | 37 [NSBundle bundleWithPath:[base::mac::CFToNSCast(appURL) path]]; |
38 CFRelease(appURL); | 38 CFRelease(appURL); |
39 NSString *ff_library_path = | 39 NSString *ff_library_path = |
40 [[ff_bundle executablePath] stringByDeletingLastPathComponent]; | 40 [[ff_bundle executablePath] stringByDeletingLastPathComponent]; |
41 char buf[MAXPATHLEN]; | 41 char buf[MAXPATHLEN]; |
42 if (![ff_library_path getFileSystemRepresentation:buf maxLength:sizeof(buf)]) | 42 if (![ff_library_path getFileSystemRepresentation:buf maxLength:sizeof(buf)]) |
43 return base::FilePath(); | 43 return base::FilePath(); |
44 return base::FilePath(buf); | 44 return base::FilePath(buf); |
45 } | 45 } |
OLD | NEW |