Renamed 'native_path()' to 'convert_path()'.

Also changed it so it doesn't barf if the path is already in native format
  (ie. contains os.sep).
This commit is contained in:
Greg Ward 2000-05-31 02:32:10 +00:00
parent 65bc20c23e
commit d8dfb4c4b8
3 changed files with 11 additions and 15 deletions

View file

@ -58,7 +58,7 @@ def get_platform ():
# get_platform()
def native_path (pathname):
def convert_path (pathname):
"""Return 'pathname' as a name that will work on the native
filesystem, i.e. split it on '/' and put it back together again
using the current directory separator. Needed because filenames in
@ -73,16 +73,12 @@ def native_path (pathname):
if pathname[-1] == '/':
raise ValueError, "path '%s' cannot end with '/'" % pathname
if os.sep != '/':
if os.sep in pathname:
raise ValueError, \
"path '%s' cannot contain '%c' character" % (pathname, os.sep)
else:
paths = string.split (pathname, '/')
return apply (os.path.join, paths)
paths = string.split (pathname, '/')
return apply (os.path.join, paths)
else:
return pathname
# native_path ()
# convert_path ()
def change_root (new_root, pathname):