Changeset 24971 for main/trunk/greenstone2/perllib/util.pm
- Timestamp:
- 2012-01-24T16:19:58+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/util.pm
r24940 r24971 837 837 my $filename = shift (@_); 838 838 839 # need to put single backslash back todouble so that regex works839 # need to make single backslashes double so that regex works 840 840 $filename =~ s/\\/\\\\/g; # if ($ENV{'GSDLOS'} =~ /^windows$/i); 841 841 … … 1067 1067 # convert parameters only to / slashes if Windows 1068 1068 1069 my $filename_urlformat = $filename; 1070 my $within_dir_urlformat = $within_dir; 1071 1072 if ($ENV{'GSDLOS'} =~ /^windows$/i) { 1073 # Only need to worry about Windows, as Unix style directories already in url-format 1074 # Convert Windows style \ => / 1075 $filename_urlformat =~ s@\\@/@g; 1076 $within_dir_urlformat =~ s@\\@/@g; 1077 } 1078 1069 my $filename_urlformat = &filepath_to_url_format($filename); 1070 my $within_dir_urlformat = &filepath_to_url_format($within_dir); 1071 1079 1072 #if ($within_dir_urlformat !~ m/\/$/) { 1080 1073 # make sure directory ends with a slash … … 1092 1085 1093 1086 return $filename_urlformat; 1087 } 1088 1089 # Convert parameter to use / slashes if Windows (if on Linux leave any \ as is, 1090 # since on Linux it doesn't represent a file separator but an escape char). 1091 sub filepath_to_url_format 1092 { 1093 my ($filepath) = @_; 1094 if ($ENV{'GSDLOS'} =~ /^windows$/i) { 1095 # Only need to worry about Windows, as Unix style directories already in url-format 1096 # Convert Windows style \ => / 1097 $filepath =~ s@\\@/@g; 1098 } 1099 return $filepath; 1094 1100 } 1095 1101
Note:
See TracChangeset
for help on using the changeset viewer.