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

[tor-commits] [stem/master] Fixed bug that util.system.expand_path does not expand tildas on windows



commit 62e51e9e98ef2d2f309eece027d7d2417e18dedd
Author: Beck <csybeck@xxxxxxxxx>
Date:   Fri Jun 22 23:22:42 2012 +0800

    Fixed bug that util.system.expand_path does not expand tildas on windows
---
 stem/util/system.py       |    2 +-
 test/integ/util/system.py |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/stem/util/system.py b/stem/util/system.py
index b4c326f..799219b 100644
--- a/stem/util/system.py
+++ b/stem/util/system.py
@@ -526,7 +526,7 @@ def expand_path(path, cwd = None):
   if not relative_path or os.path.isabs(relative_path):
     # empty or already absolute - nothing to do
     pass
-  elif not is_windows() and relative_path.startswith("~"):
+  elif relative_path.startswith("~"):
     # prefixed with a ~ or ~user entry
     relative_path = os.path.expanduser(relative_path)
   else:
diff --git a/test/integ/util/system.py b/test/integ/util/system.py
index 3af6f77..a99e56c 100644
--- a/test/integ/util/system.py
+++ b/test/integ/util/system.py
@@ -377,7 +377,7 @@ class TestSystem(unittest.TestCase):
     self.assertEquals(os.getcwd(), stem.util.system.expand_path("./"))
     self.assertEquals(os.path.join(os.getcwd(), "foo"), stem.util.system.expand_path("./foo"))
     
-    home_dir, username = os.getenv("HOME"), getpass.getuser()
+    home_dir, username = os.path.expanduser("~"), getpass.getuser()
     self.assertEquals(home_dir, stem.util.system.expand_path("~"))
     self.assertEquals(home_dir, stem.util.system.expand_path("~/"))
     self.assertEquals(home_dir, stem.util.system.expand_path("~%s" % username))



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