OSDN Git Service

portability: small code cleanup
[mypaint-anime/master.git] / mypaint.py
index 8f7944c..6d45573 100644 (file)
@@ -53,12 +53,12 @@ def get_paths():
     # note: some distros use lib64 instead, they have to edit this...
     lib_compiled='lib/mypaint/'
 
+    # convert sys.argv to a list of unicode objects
     if sys.platform == 'win32':
         sys.argv = win32_unicode_argv()
-        arg0 = sys.argv[0]
     else:
-        arg0 = sys.argv[0].decode(sys.getfilesystemencoding())
-    scriptdir=os.path.dirname(arg0)
+        sys.argv = [s.decode(sys.getfilesystemencoding()) for s in sys.argv]
+    scriptdir=os.path.dirname(sys.argv[0])
 
     # this script is installed as $prefix/bin. We just need $prefix to continue.
     #pwd=os.getcwd() # why????
@@ -77,7 +77,7 @@ def get_paths():
         prefix=None
         # this is py2exe point of view, all executables in root of installdir
         # all path must be normalized to absolute path
-        libpath = os.path.abspath(os.path.dirname(os.path.realpath(arg0)))
+        libpath = os.path.abspath(os.path.dirname(os.path.realpath(sys.argv[0])))
         sys.path.insert(0, libpath)
         localepath = join(libpath,'share/locale')
     else: