Changeset 25093 for main/trunk/greenstone2/perllib/util.pm
- Timestamp:
- 2012-02-16T15:06:36+13:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/util.pm
r24971 r25093 1100 1100 } 1101 1101 1102 # regex filepaths on windows may include \\ as path separator. Convert \\ to / 1103 sub filepath_regex_to_url_format 1104 { 1105 my ($filepath) = @_; 1106 if ($ENV{'GSDLOS'} =~ /^windows$/i) { 1107 # Only need to worry about Windows, as Unix style directories already in url-format 1108 # Convert Windows style \\ => / 1109 $filepath =~ s@\\\\@/@g; 1110 } 1111 return $filepath; 1112 1113 } 1114 1115 # Like File::Basename::fileparse, but expects filepath in url format (ie only / slash for dirsep) 1116 # and ignores trailing / 1117 # returns (file, dirs) dirs will be empty if no subdirs 1118 sub url_fileparse 1119 { 1120 my ($filepath) = @_; 1121 # remove trailing / 1122 $filepath =~ s@/$@@; 1123 if ($filepath !~ m@/@) { 1124 return ($filepath, ""); 1125 } 1126 my ($dirs, $file) = $filepath =~ m@(.+/)([^/]+)@; 1127 return ($file, $dirs); 1128 1129 } 1130 1102 1131 1103 1132 sub filename_within_collection
Note:
See TracChangeset
for help on using the changeset viewer.