[tbb-commits] [tor-launcher/master] fixup! Bug 13252 - Do not store data in the app bundle

gk at torproject.org gk at torproject.org
Wed Mar 30 19:08:42 UTC 2016


commit c4d03f9b16b625f11a08fe0f6dfc5ed6b2467638
Author: Kathy Brade <brade at pearlcrescent.com>
Date:   Fri Mar 25 10:08:15 2016 -0400

    fixup! Bug 13252 - Do not store data in the app bundle
    
    Mac OS: account for the fact that user data is sometimes
    stored under ~/Library/Application Support/TorBrowser-Data.
---
 src/components/tl-process.js | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/components/tl-process.js b/src/components/tl-process.js
index ccbee12..7daa31f 100644
--- a/src/components/tl-process.js
+++ b/src/components/tl-process.js
@@ -822,12 +822,13 @@ TorProcessService.prototype =
     if (this.mIsUserDataOutsideOfAppDir == undefined)
     {
       // Determine if we are using a "side-by-side" data model by checking
-      // for the existence of the TorBrowser-Data/ directory.
+      // whether the user profile is outside of the app directory.
       try
       {
-        let f = this._appDir.parent;
-        f.append("TorBrowser-Data");
-        this.mIsUserDataOutsideOfAppDir = f.exists() && f.isDirectory();
+        let ds = Cc["@mozilla.org/file/directory_service;1"]
+                        .getService(Ci.nsIProperties);
+        let profDir = ds.get("ProfD", Ci.nsIFile);
+        this.mIsUserDataOutsideOfAppDir = !this._appDir.contains(profDir);
       }
       catch (e)
       {
@@ -881,14 +882,16 @@ TorProcessService.prototype =
   }, // get _appDir
 
   // Returns an nsIFile that points to the TorBrowser-Data/ directory.
+  // This function is only used when this._isUserDataOutsideOfAppDir == true.
   // May throw.
   get _dataDir()
   {
     if (!this.mDataDir)
     {
-      let f = this._appDir.parent.clone();
-      f.append("TorBrowser-Data");
-      this.mDataDir = f;
+      let ds = Cc["@mozilla.org/file/directory_service;1"]
+                      .getService(Ci.nsIProperties);
+      let profDir = ds.get("ProfD", Ci.nsIFile);
+      this.mDataDir = profDir.parent.parent;
     }
 
     return this.mDataDir;



More information about the tbb-commits mailing list