Ticket #150: os2knixpath.py.diff
File os2knixpath.py.diff, 1.5 KB (added by , 9 years ago) |
---|
-
os2knixpath.py
old new 19 19 "splitunc","curdir","pardir","sep","pathsep","defpath","altsep", 20 20 "extsep","devnull","realpath","supports_unicode_filenames"] 21 21 22 _unixroot = os.environ.get('UNIXROOT') 23 22 24 # strings representing various path-related bits and pieces 23 25 curdir = '.' 24 26 pardir = '..' … … 26 28 sep = '/' 27 29 altsep = '\\' 28 30 pathsep = ';' 29 defpath = '.;' + ( os.environ['UNIXROOT'] + '\\usr\\bin' if 'UNIXROOT' in os.environelse 'C:\\bin')31 defpath = '.;' + (_unixroot.replace(sep, altsep) + '\\usr\\bin' if _unixroot else 'C:\\bin') 30 32 devnull = 'nul' 31 33 34 _unixroot_normcase = _unixroot.replace(altsep, sep).lower() 35 32 36 # Normalize the case of a pathname and map slashes to backslashes. 33 37 # Other normalizations (such as optimizing '../' away) are not done 34 38 # (this is done by normpath). … … 36 40 def normcase(s): 37 41 """Normalize case of pathname. 38 42 39 Makes all characters lowercase and all altseps into seps.""" 40 return s.replace(altsep, sep).lower() 43 Makes all characters lowercase and all altseps into seps. 41 44 45 Also, if the string starts with os.environ['UNIXROOT'], this part 46 will be replaced with '/@unixroot' to ensure portability of the 47 returned path across different installations.""" 48 s = s.replace(altsep, sep).lower() 49 if _unixroot: 50 s = s.replace(_unixroot_normcase, '/@unixroot') 51 return s 42 52 43 53 # Join two (or more) paths. 44 54