Pier Angelo Vendrame pushed to branch tor-browser-115.7.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits: c78c48e7 by Pier Angelo Vendrame at 2024-02-07T16:34:15+01:00 fixup! Bug 9173: Change the default Firefox profile directory to be relative.
Add a method to query whether the browser is in portable mode.
- - - - -
2 changed files:
- toolkit/xre/nsIXREDirProvider.idl - toolkit/xre/nsXREDirProvider.cpp
Changes:
===================================== toolkit/xre/nsIXREDirProvider.idl ===================================== @@ -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; };
===================================== toolkit/xre/nsXREDirProvider.cpp ===================================== @@ -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)
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/c78c48e7...
tor-commits@lists.torproject.org