export function defaultCreateProfileFinder()

in src/firefox/index.js [229:252]


export function defaultCreateProfileFinder({
  userDirectoryPath,
  FxProfile = FirefoxProfile,
} = {}) {
  const finder = new FxProfile.Finder(userDirectoryPath);
  const readProfiles = promisify((...args) => finder.readProfiles(...args));
  const getPath = promisify((...args) => finder.getPath(...args));
  return async (profileName) => {
    try {
      await readProfiles();
      const hasProfileName =
        finder.profiles.filter((profileDef) => profileDef.Name === profileName)
          .length !== 0;
      if (hasProfileName) {
        return await getPath(profileName);
      }
    } catch (error) {
      if (!isErrorWithCode('ENOENT', error)) {
        throw error;
      }
      log.warn('Unable to find Firefox profiles.ini');
    }
  };
}