Home | History | Annotate | Download | only in importer
      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
      3 // found in the LICENSE file.
      4 
      5 #include <Cocoa/Cocoa.h>
      6 
      7 #include "chrome/browser/importer/firefox_importer_utils.h"
      8 
      9 #include "base/file_util.h"
     10 #include "base/path_service.h"
     11 
     12 FilePath GetProfilesINI() {
     13   FilePath app_data_path;
     14   if (!PathService::Get(base::DIR_APP_DATA, &app_data_path)) {
     15     return FilePath();
     16   }
     17   FilePath ini_file = app_data_path.Append("Firefox").Append("profiles.ini");
     18   if (!file_util::PathExists(ini_file)) {
     19     return FilePath();
     20   }
     21   return ini_file;
     22 }
     23 
     24 FilePath GetFirefoxDylibPath() {
     25   CFURLRef appURL = nil;
     26   if (LSFindApplicationForInfo(kLSUnknownCreator,
     27                               CFSTR("org.mozilla.firefox"),
     28                               NULL,
     29                               NULL,
     30                               &appURL) != noErr) {
     31     return FilePath();
     32   }
     33   NSBundle *ff_bundle = [NSBundle
     34       bundleWithPath:[reinterpret_cast<const NSURL*>(appURL) path]];
     35   CFRelease(appURL);
     36   NSString *ff_library_path = [[ff_bundle executablePath]
     37                                   stringByDeletingLastPathComponent];
     38 
     39   return FilePath([ff_library_path fileSystemRepresentation]);
     40 }
     41