Changeset 4320

Show
Ignore:
Timestamp:
07/24/2008 03:07:44 PM (1 month ago)
Author:
paul
Message:

[4275] broke Dabo working with py2exe applications that set the dabo locale dir to 'dabo.locale/', such as those applications generated with the AppWizard?. This fixes my issue, but Ed please test with tweezer to see if it messes your stuff up.

Files:

Legend:

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

    r4275 r4320  
    8989 
    9090def getDaboLocaleDir(): 
    91     localeDirName = "locale" 
    92     localeDir = os.path.join(os.path.split(dabo.__file__)[0], localeDirName) 
    93     if not os.path.isdir(localeDir): 
    94         # Frozen app? 
    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. 
    97         startupDir = localeDir 
    98         while startupDir: 
    99             newDir = os.path.split(startupDir)[0] 
    100             if newDir == startupDir: 
    101                 # At the root dir 
     91    localeDirNames = ("dabo.locale", "locale") 
     92    for localeDirName in localeDirNames: 
     93        localeDir = os.path.join(os.path.split(dabo.__file__)[0], localeDirName) 
     94        if not os.path.isdir(localeDir): 
     95            # Frozen app? 
     96            # First need to find the directory that contains the executable. On the Mac, 
     97            # it might be a directory at a lower level than dabo itself. 
     98            startupDir = localeDir 
     99            while startupDir: 
     100                newDir = os.path.split(startupDir)[0] 
     101                if newDir == startupDir: 
     102                    # At the root dir 
     103                    break 
     104                startupDir = newDir 
     105                candidate = os.path.join(startupDir, localeDirName) 
     106                if os.path.isdir(candidate): 
     107                    break 
     108            if os.path.isdir(candidate): 
     109                localeDir = candidate 
    102110                break 
    103             startupDir = newDir 
    104             candidate = os.path.join(startupDir, localeDirName) 
    105             if os.path.isdir(candidate): 
    106                 break 
    107         localeDir = candidate 
    108111    return localeDir 
    109112