← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~mahfiaz/openlp/filesystem_encoding into lp:openlp

 

mahfiaz has proposed merging lp:~mahfiaz/openlp/filesystem_encoding into lp:openlp.

Requested reviews:
  OpenLP Core (openlp-core)

For more details, see:
https://code.launchpad.net/~mahfiaz/openlp/filesystem_encoding/+merge/49858
-- 
https://code.launchpad.net/~mahfiaz/openlp/filesystem_encoding/+merge/49858
Your team OpenLP Core is requested to review the proposed merge of lp:~mahfiaz/openlp/filesystem_encoding into lp:openlp.
=== modified file 'openlp/core/utils/__init__.py'
--- openlp/core/utils/__init__.py	2011-02-13 20:03:55 +0000
+++ openlp/core/utils/__init__.py	2011-02-15 19:03:56 +0000
@@ -164,27 +164,34 @@
     """
     Return a path based on which OS and environment we are running in.
     """
+    encoding = sys.getfilesystemencoding()
     if sys.platform == u'win32':
         if dir_type == AppLocation.DataDir:
-            return os.path.join(os.getenv(u'APPDATA'), u'openlp', u'data')
-        return os.path.join(os.getenv(u'APPDATA'), u'openlp')
+            return os.path.join(unicode(os.getenv(u'APPDATA'), encoding),
+                u'openlp', u'data')
+        return os.path.join(unicode(os.getenv(u'APPDATA'), encoding),
+            u'openlp')
     elif sys.platform == u'darwin':
         if dir_type == AppLocation.DataDir:
-            return os.path.join(os.getenv(u'HOME'), u'Library',
-                u'Application Support', u'openlp', u'Data')
-        return os.path.join(os.getenv(u'HOME'), u'Library',
-            u'Application Support', u'openlp')
+            return os.path.join(unicode(os.getenv(u'HOME'), encoding),
+                u'Library', u'Application Support', u'openlp', u'Data')
+        return os.path.join(unicode(os.getenv(u'HOME'), encoding),
+            u'Library', u'Application Support', u'openlp')
     else:
         if XDG_BASE_AVAILABLE:
             if dir_type == AppLocation.ConfigDir:
-                return os.path.join(BaseDirectory.xdg_config_home, u'openlp')
+                return os.path.join(unicode(BaseDirectory.xdg_config_home,
+                    encoding), u'openlp')
             elif dir_type == AppLocation.DataDir:
-                return os.path.join(BaseDirectory.xdg_data_home, u'openlp')
+                return os.path.join(
+                    unicode(BaseDirectory.xdg_data_home, encoding), u'openlp')
             elif dir_type == AppLocation.CacheDir:
-                return os.path.join(BaseDirectory.xdg_cache_home, u'openlp')
+                return os.path.join(unicode(BaseDirectory.xdg_cache_home,
+                    encoding), u'openlp')
         if dir_type == AppLocation.DataDir:
-            return os.path.join(os.getenv(u'HOME'), u'.openlp', u'data')
-        return os.path.join(os.getenv(u'HOME'), u'.openlp')
+            return os.path.join(unicode(os.getenv(u'HOME'), encoding),
+                u'.openlp', u'data')
+        return os.path.join(unicode(os.getenv(u'HOME'), encoding), u'.openlp')
 
 def _get_frozen_path(frozen_option, non_frozen_option):
     """


Follow ups