Changeset 4275

Show
Ignore:
Timestamp:
07/13/08 11:46:58 (3 months ago)
Author:
ed
Message:

Updated the getDaboLocaleDir() method to work with py2app-built files.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/dabo/dLocalize.py

    r3411 r4275  
    8989 
    9090def getDaboLocaleDir(): 
    91     localeDir = os.path.join(os.path.split(dabo.__file__)[0], "locale") 
     91    localeDirName = "locale" 
     92    localeDir = os.path.join(os.path.split(dabo.__file__)[0], localeDirName) 
    9293    if not os.path.isdir(localeDir): 
    9394        # Frozen app? 
    94         # First need to find the directory that contains the .exe: 
     95        # First need to find the directory that contains the executable. On the Mac, 
     96        # it might be a directory at a lower level than dabo itself. 
    9597        startupDir = localeDir 
    9698        while startupDir: 
    97             startupDir = os.path.split(startupDir)[0] 
    98             if os.path.isdir(startupDir): 
     99            newDir = os.path.split(startupDir)[0] 
     100            if newDir == startupDir: 
     101                # At the root dir 
    99102                break 
    100         localeDir = os.path.join(startupDir, "dabo.locale") 
     103            startupDir = newDir 
     104            candidate = os.path.join(startupDir, localeDirName) 
     105            if os.path.isdir(candidate): 
     106                break 
     107        localeDir = candidate 
    101108    return localeDir 
    102109