From aaf0e6043fd7be7dfd21447b3698ed18f8a19062 Mon Sep 17 00:00:00 2001 From: pcanterino <> Date: Tue, 4 Jan 2005 12:53:57 +0000 Subject: [PATCH] - In the virtual directory string, check_path() converts backslashes to slashes before removing slashes at the beginning (not really necessary, but I want to be sure) - check_path() and equal_url() now remove multiple disturbing slashes in strings --- modules/Tool.pm | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/Tool.pm b/modules/Tool.pm index e261f3e..a05b459 100644 --- a/modules/Tool.pm +++ b/modules/Tool.pm @@ -6,7 +6,7 @@ package Tool; # Some shared sub routines # # Author: Patrick Canterino -# Last modified: 2004-12-25 +# Last modified: 2005-01-04 # use strict; @@ -54,8 +54,9 @@ sub check_path($$) $root = abs_path($root); $root = File::Spec->canonpath($root); - $path =~ s!^/{1}!!; - $path = $root."/".$path; + $path =~ tr!\\!/!; + $path =~ s!^/+!!; + $path = $root."/".$path; # We extract the last part of the path and create the absolute path @@ -76,7 +77,7 @@ sub check_path($$) # Create short path name my $short_path = substr($path,length($root)); - $short_path =~ tr!\\!\/!; + $short_path =~ tr!\\!/!; $short_path = "/".$short_path if($short_path !~ m!^/!); $short_path = $short_path."/" if($short_path !~ m!/$! && -d $path); @@ -198,8 +199,8 @@ sub equal_url($$) my ($root,$path) = @_; my $url; - $root =~ s!/$!!; - $path =~ s!^/!!; + $root =~ s!/+$!!; + $path =~ s!^/+!!; $url = $root."/".$path; return $url; -- 2.34.1