- Timestamp:
- 2013-05-27T12:27:31+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/parallel-building/trunk/src/perllib/FileUtils/LocalFS.pm
r27422 r27481 215 215 } 216 216 # /** linkFile() **/ 217 218 ## @function makeAllDirectories()219 #220 # in case anyone cares - I did some testing (using perls Benchmark module)221 # on this subroutine against File::Path::mkpath (). mk_all_dir() is apparently222 # slightly faster (surprisingly) - Stefan.223 #224 sub makeAllDirectories225 {226 my ($dir) = @_;227 228 # use / for the directory separator, remove duplicate and229 # trailing slashes230 $dir=~s/[\\\/]+/\//g;231 $dir=~s/[\\\/]+$//;232 233 # ensure the directory doesn't already exist234 if (-e $dir)235 {236 return 0;237 }238 239 # make sure the cache directory exists240 my $dirsofar = "";241 my $first = 1;242 foreach my $dirname (split ("/", $dir))243 {244 $dirsofar .= "/" unless $first;245 $first = 0;246 247 $dirsofar .= $dirname;248 249 next if $dirname =~ /^(|[a-z]:)$/i;250 if (!-e $dirsofar)251 {252 my $store_umask = umask(0002);253 my $mkdir_ok = mkdir ($dirsofar, 0777);254 umask($store_umask);255 if (!$mkdir_ok)256 {257 &FileUtils::printError('Could not create directory: ' . $dirsofar);258 return 0;259 }260 }261 }262 return (-e $dir);263 }264 ## makeAllDirectories()265 266 217 267 218 ## @function makeDirectory()
Note:
See TracChangeset
for help on using the changeset viewer.