euphoria

changeset 4677:c131a87ee326 4.0

fixes ticket 615. Now works in Windows taking drive id, slashes and case into consideration.
author DerekParnell
date Sun Feb 27 09:09:47 2011 +1100 (2011-02-27)
parents 45a28c65debf
children f66713a408d1
files include/std/filesys.e
line diff
     1.1 --- a/include/std/filesys.e	Sun Feb 27 01:42:17 2011 +1100
     1.2 +++ b/include/std/filesys.e	Sun Feb 27 09:09:47 2011 +1100
     1.3 @@ -1640,25 +1640,20 @@
     1.4  
     1.5  public function abbreviate_path(sequence orig_path, sequence base_paths = {})
     1.6  	sequence expanded_path
     1.7 -	
     1.8 +
     1.9  	-- Get full path of the parameter
    1.10  	expanded_path = canonical_path(orig_path)
    1.11  	
    1.12  	-- Add the current directory onto the list of base search paths.
    1.13  	base_paths = append(base_paths, curdir())
    1.14  	
    1.15 +	for i = 1 to length(base_paths) do
    1.16 +		base_paths[i] = canonical_path(base_paths[i], 1) -- assume each base path is meant to be a directory.
    1.17 +	end for
    1.18 +	
    1.19  	-- normalize for OSes with case insensitive filesystems
    1.20  	-- by setting all to lowercase
    1.21  	base_paths = fs_case(base_paths)
    1.22 -	
    1.23 -	ifdef WINDOWS then
    1.24 -		-- replace any unix style slashes with Windows style ones.
    1.25 -		for i = 1 to length(base_paths) do
    1.26 -			base_paths[i] = match_replace('/', base_paths[i], `/`)
    1.27 -		end for
    1.28 -		expanded_path = match_replace('/', expanded_path, `/`)
    1.29 -	end ifdef
    1.30 -	
    1.31  	sequence lowered_expanded_path = fs_case(expanded_path)
    1.32  	
    1.33  	-- The first pass is to see if the parameter begins with any of the base paths.

SCM Home | OpenEuphoria.org Home