Verified Commit c78c48e7 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃
Browse files

fixup! Bug 9173: Change the default Firefox profile directory to be relative.

Add a method to query whether the browser is in portable mode.
parent b90988c5
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -20,4 +20,9 @@ interface nsIXREDirProvider : nsISupports
   * Gets the hash for the current installation directory.
   */
  AString getInstallHash();

  /**
   * Tells whether the browser has been started in portable mode.
   */
  readonly attribute bool isPortableMode;
};
+14 −0
Original line number Diff line number Diff line
@@ -1334,6 +1334,20 @@ nsresult nsXREDirProvider::GetPortableDataDir(nsIFile** aFile,
}
#endif

NS_IMETHODIMP nsXREDirProvider::GetIsPortableMode(bool* aIsPortableMode) {
#ifdef RELATIVE_DATA_DIR
  if (gDataDirPortable) {
    *aIsPortableMode = *gDataDirPortable;
  } else {
    nsCOMPtr<nsIFile> dir;
    GetPortableDataDir(getter_AddRefs(dir), *aIsPortableMode);
  }
#else
  *aIsPortableMode = false;
#endif
  return NS_OK;
}

nsresult nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile,
                                                    bool aLocal) {
  // Copied from nsAppFileLocationProvider (more or less)