dabo Commit
Revision 6261
Date: 2010-12-17 16:32:49 -0800 (Fri, 17 Dec 2010)
Author: Paul
Trac: http://trac.dabodev.com/changeset/6261

Changed:
U   trunk/dabo/dLocalize.py

Log:
Updated the getDaboLocalDir() for pyInstaller installations.

Diff:
Modified: trunk/dabo/dLocalize.py
===================================================================
--- trunk/dabo/dLocalize.py     2010-12-17 23:31:27 UTC (rev 6260)
+++ trunk/dabo/dLocalize.py     2010-12-18 00:32:49 UTC (rev 6261)
@@ -1,4 +1,4 @@
-# -*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
 
 import sys
 import os
@@ -107,25 +107,31 @@
 
 def getDaboLocaleDir():
        localeDirNames = ("dabo.locale", "locale")
-       for localeDirName in localeDirNames:
-               localeDir = os.path.join(os.path.split(dabo.__file__)[0], 
localeDirName)
-               if not os.path.isdir(localeDir):
-                       # Frozen app?
-                       # First need to find the directory that contains the 
executable. On the Mac,
-                       # it might be a directory at a lower level than dabo 
itself.
-                       startupDir = localeDir
-                       while startupDir:
-                               newDir = os.path.split(startupDir)[0]
-                               if newDir == startupDir:
-                                       # At the root dir
-                                       break
-                               startupDir = newDir
-                               candidate = os.path.join(startupDir, 
localeDirName)
+       localeDirRoots = [os.path.split(dabo.__file__)[0]] + sys.path
+       for localeDirRoot in localeDirRoots:
+               for localeDirName in localeDirNames:
+                       localeDir = os.path.join(localeDirRoot, localeDirName)
+                       if not os.path.isdir(localeDir):
+                               # Frozen app?
+                               # First need to find the directory that 
contains the executable. On the Mac,
+                               # it might be a directory at a lower level than 
dabo itself.
+                               startupDir = localeDir
+                               while startupDir:
+                                       newDir = os.path.split(startupDir)[0]
+                                       if newDir == startupDir:
+                                               # At the root dir
+                                               break
+                                       startupDir = newDir
+                                       candidate = os.path.join(startupDir, 
localeDirName)
+                                       if os.path.isdir(candidate):
+                                               break
                                if os.path.isdir(candidate):
+                                       localeDir = candidate
                                        break
-                       if os.path.isdir(candidate):
-                               localeDir = candidate
+                       if os.path.isdir(localeDir):
                                break
+               if os.path.isdir(localeDir):
+                       break
        return localeDir
 
 



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to