Changeset 28213 for main/trunk
- Timestamp:
- 2013-09-04T22:09:17+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/util.pm
r28211 r28213 1259 1259 } 1260 1260 1261 elsif (defined $ENV{'SITEHOME'}) { #&FileUtils::filenameConcatenate(&util::get_site_dir($site),"collect");1261 elsif (defined $ENV{'SITEHOME'}) { 1262 1262 return &FileUtils::filenameConcatenate($ENV{'SITEHOME'},"collect"); 1263 1263 } … … 1267 1267 } 1268 1268 } 1269 1270 sub is_abs_path_this_os {1271 my ($path) = @_;1272 1273 # File::Spec loads the module appropriate for the OS1274 return &FileUtils::isFilenameAbsolute(@_); #return File::Spec->file_name_is_absolute( $path );1275 }1276 1277 1269 1278 1270 sub is_abs_path_any_os { … … 1305 1297 1306 1298 # now we know we're dealing with absolute paths and have to replace gs prefixes with placeholders 1307 1308 my $site = $ENV{'SITEHOME'} ? $ENV{'SITEHOME'} : ""; 1309 my @gs_paths = ($ENV{'GSDLCOLLECTDIR'}, $ENV{'GSDLCOLLECTHOME'}, $site, $ENV{'GREENSTONEHOME'}); # list in this order: from longest to shortest path 1299 my @gs_paths = ($ENV{'GSDLCOLLECTDIR'}, $ENV{'GSDLCOLLECTHOME'}, $ENV{'SITEHOME'}, $ENV{'GREENSTONEHOME'}); # list in this order: from longest to shortest path 1310 1300 1311 1301 my %placeholder_map = ($ENV{'GREENSTONEHOME'} => '@GSDLHOME@', # can't use double-quotes around at-sign, else perl tries to evaluate it as referring to an array 1312 $site => '@SITEHOME@',1313 1302 $ENV{'GSDLCOLLECTHOME'} => '@COLLECTHOME@', 1314 1303 $ENV{'GSDLCOLLECTDIR'} => '@THISCOLLECTPATH@' 1315 1304 ); 1305 $placeholder_map{$ENV{'SITEHOME'}} = '@SITEHOME@' if defined $ENV{'SITEHOME'}; 1316 1306 1317 1307 … … 1321 1311 1322 1312 foreach my $gs_path (@gs_paths) { 1323 next if( $gs_path eq ""); # site can be empty1313 next if(!defined $gs_path); # site undefined for GS2 1324 1314 1325 1315 my $re_path = &util::filename_to_regex($gs_path); # escape for regex … … 1345 1335 return $path if($path !~ m/@/); # path contains no placeholders 1346 1336 1347 # replace placeholders with gs prefixes 1348 my $site = $ENV{'SITEHOME'} ? $ENV{'SITEHOME'} : ""; 1337 # replace placeholders with gs prefixes 1349 1338 my @placeholders = ('@THISCOLLECTPATH@', '@COLLECTHOME@', '@SITEHOME@', '@GSDLHOME@'); # order of paths not crucial in this case, 1350 1339 # but listed here from longest to shortest once placeholders are have been resolved 1351 1340 1352 my %placeholder_to_gspath_map = ('@GSDLHOME@' => $ENV{'GREENSTONEHOME'},# can't use double-quotes around at-sign, else perl tries to evaluate it as referring to an array1353 '@SITEHOME@' => $site,1354 '@COLLECTHOME@' => $ENV{'GSDLCOLLECTHOME'},1355 '@THISCOLLECTPATH@' => $ENV{'GSDLCOLLECTDIR'}1356 );1357 1341 # can't use double-quotes around at-sign, else perl tries to evaluate it as referring to an array 1342 my %placeholder_to_gspath_map = ('@GSDLHOME@' => $ENV{'GREENSTONEHOME'}, 1343 '@SITEHOME@' => $ENV{'SITEHOME'}, 1344 '@COLLECTHOME@' => $ENV{'GSDLCOLLECTHOME'}, 1345 '@THISCOLLECTPATH@' => $ENV{'GSDLCOLLECTDIR'} 1346 ); # $placeholder_to_gspath_map{'@SITEHOME@'} = $ENV{'SITEHOME'} if defined $ENV{'SITEHOME'}; 1358 1347 1359 1348 foreach my $placeholder (@placeholders) { 1360 1349 my $gs_path = $placeholder_to_gspath_map{$placeholder}; 1361 1350 1362 next if( $gs_path eq ""); # no value for sitehome for GS21351 next if(!defined $gs_path); # sitehome for GS2 is undefined 1363 1352 1364 1353 #my $sep = ($ENV{'GSDLOS'} eq "windows") ? "\\" : "/";
Note:
See TracChangeset
for help on using the changeset viewer.