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
3 // found in the LICENSE file.
5 #include <Cocoa/Cocoa.h>
8 #include "chrome/common/importer/firefox_importer_utils.h"
10 #include "base/files/file_util.h"
11 #include "base/mac/foundation_util.h"
12 #include "base/path_service.h"
14 base::FilePath GetProfilesINI() {
15 base::FilePath app_data_path;
16 if (!PathService::Get(base::DIR_APP_DATA, &app_data_path)) {
17 return base::FilePath();
19 base::FilePath ini_file =
20 app_data_path.Append("Firefox").Append("profiles.ini");
21 if (!base::PathExists(ini_file)) {
22 return base::FilePath();
27 base::FilePath GetFirefoxDylibPath() {
28 CFURLRef appURL = nil;
29 if (LSFindApplicationForInfo(kLSUnknownCreator,
30 CFSTR("org.mozilla.firefox"),
34 return base::FilePath();
37 [NSBundle bundleWithPath:[base::mac::CFToNSCast(appURL) path]];
39 NSString *ff_library_path =
40 [[ff_bundle executablePath] stringByDeletingLastPathComponent];
42 if (![ff_library_path getFileSystemRepresentation:buf maxLength:sizeof(buf)])
43 return base::FilePath();
44 return base::FilePath(buf);