Rev 2246: make sure encoding for cache dir is correct. in http://people.samba.org/bzr/jelmer/bzr-svn/0.5

Jelmer Vernooij jelmer at samba.org
Mon Dec 8 17:52:14 GMT 2008


At http://people.samba.org/bzr/jelmer/bzr-svn/0.5

------------------------------------------------------------
revno: 2246
revision-id: jelmer at samba.org-20081208175211-j2eo6w5mp1tt4n93
parent: jelmer at samba.org-20081208174554-3mbga49yin75mkw1
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.5
timestamp: Mon 2008-12-08 18:52:11 +0100
message:
  make sure encoding for cache dir is correct.
modified:
  cache.py                       cache.py-20070520185908-qbtlcet08bllgs0f-1
=== modified file 'cache.py'
--- a/cache.py	2008-09-09 11:32:56 +0000
+++ b/cache.py	2008-12-08 17:52:11 +0000
@@ -16,9 +16,16 @@
 """Subversion cache directory access."""
 
 import bzrlib
-from bzrlib import debug
-from bzrlib.config import config_dir, ensure_config_dir_exists
+from bzrlib import (
+    debug, 
+    osutils,
+    )
+from bzrlib.config import (
+    config_dir,
+    ensure_config_dir_exists,
+    )
 from bzrlib.trace import mutter, warning
+
 from bzrlib.plugins.svn import version_info
 
 import os, sys
@@ -41,8 +48,13 @@
         except ImportError:
             base_cache_dir = config_dir()
         else:
-            base_cache_dir = get_local_appdata_location()
-            assert base_cache_dir is not None
+            s = get_local_appdata_location()
+            assert s is not None
+            # This can return a unicode string or a plain string in 
+            # user encoding
+            if type(s) == str:
+                s = s.decode(osutils.get_user_encoding())
+            base_cache_dir = s.encode(osutils._fs_enc)
     else:
         base_cache_dir = config_dir()
     cache_dir = os.path.join(base_cache_dir, name)




More information about the bazaar-commits mailing list