mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 23:21:29 +00:00 
			
		
		
		
	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:
		
							parent
							
								
									65bc20c23e
								
							
						
					
					
						commit
						d8dfb4c4b8
					
				
					 3 changed files with 11 additions and 15 deletions
				
			
		| 
						 | 
				
			
			@ -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):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue