[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser/tor-browser-24.1.1esr-1] fixup! Change the default Firefox profile directory to be TBB-relative.



commit fd1784437a94d107c789fcff6107fdd94959d4c3
Author: Kathy Brade <brade@xxxxxxxxxxxxxxxxx>
Date:   Wed Nov 20 16:38:02 2013 -0500

    fixup! Change the default Firefox profile directory to be TBB-relative.
    
    Use correct profile directory path when ./ is in the app dir.  For example,
    this happens if you start the browser via ./Contents/MacOS/firefox
---
 toolkit/xre/nsXREDirProvider.cpp       |   11 ++++++++++-
 xpcom/io/nsAppFileLocationProvider.cpp |   11 ++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/toolkit/xre/nsXREDirProvider.cpp b/toolkit/xre/nsXREDirProvider.cpp
index 0e79cd7..3e047e1 100644
--- a/toolkit/xre/nsXREDirProvider.cpp
+++ b/toolkit/xre/nsXREDirProvider.cpp
@@ -1143,11 +1143,20 @@ nsXREDirProvider::GetUserDataDirectoryHome(nsIFile** aFile, bool aLocal)
   levelsToRemove += 4;
 #endif
   while (localDir && (levelsToRemove > 0)) {
+    // When crawling up the hierarchy, components named "." do not count.
+    nsAutoCString removedName;
+    rv = localDir->GetNativeLeafName(removedName);
+    NS_ENSURE_SUCCESS(rv, rv);
+    bool didRemove = !removedName.Equals(".");
+
+    // Remove a directory component.
     nsCOMPtr<nsIFile> parentDir;
     rv = localDir->GetParent(getter_AddRefs(parentDir));
     NS_ENSURE_SUCCESS(rv, rv);
     localDir = parentDir;
-    --levelsToRemove;
+
+    if (didRemove)
+      --levelsToRemove;
   }
 
   if (!localDir)
diff --git a/xpcom/io/nsAppFileLocationProvider.cpp b/xpcom/io/nsAppFileLocationProvider.cpp
index d42f8b5..8d92c5f 100644
--- a/xpcom/io/nsAppFileLocationProvider.cpp
+++ b/xpcom/io/nsAppFileLocationProvider.cpp
@@ -305,11 +305,20 @@ NS_METHOD nsAppFileLocationProvider::GetProductDirectory(nsIFile **aLocalFile, b
     levelsToRemove += 4;
 #endif
     while (localDir && (levelsToRemove > 0)) {
+        // When crawling up the hierarchy, components named "." do not count.
+        nsAutoCString removedName;
+        rv = localDir->GetNativeLeafName(removedName);
+        NS_ENSURE_SUCCESS(rv, rv);
+        bool didRemove = !removedName.Equals(".");
+
+        // Remove a directory component.
         nsCOMPtr<nsIFile> parentDir;
         rv = localDir->GetParent(getter_AddRefs(parentDir));
         NS_ENSURE_SUCCESS(rv, rv);
         localDir = parentDir;
-        --levelsToRemove;
+
+        if (didRemove)
+          --levelsToRemove;
     }
 
     if (!localDir)

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits