- Timestamp:
- 2013-06-07T10:48:39+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gs2-extensions/parallel-building/trunk/src/perllib/FileUtils/LocalFS.pm
r27567 r27569 28 28 # Pragma 29 29 use strict; 30 31 32 # Globals 33 my $paths_we_cannot_link_from = {}; 30 34 31 35 … … 193 197 } 194 198 199 my $error_message = ucfirst(lc($mode)) . ' link failed'; 195 200 if ($ENV{'GSDLOS'} =~ /^windows$/i) 196 201 { 197 202 # symlink not supported on windows 198 &FileUtils::printWarning('Symlink not supported on windows');203 $error_message = 'Symlink not supported on windows'; 199 204 } 200 205 elsif ($mode eq 'HARD') 201 206 { 202 if (!eval {link($src, $dest)}) 203 { 204 &FileUtils::printWarning('Unable to create hard link: ' . $dest); 205 } 207 link($src, $dest); 208 #if (!eval {link($src, $dest)}) 209 #{ 210 # &FileUtils::printWarning('Unable to create hard link: ' . $dest); 211 #} 206 212 } 207 213 elsif ($mode eq 'SOFT') 208 214 { 209 if (!eval {symlink($src, $dest)}) 210 { 211 &FileUtils::printWarning('Unable to create soft link: ' . $src); 212 } 215 symlink($src, $dest); 216 #if (!eval {symlink($src, $dest)}) 217 #{ 218 # &FileUtils::printWarning('Unable to create soft link: ' . $src); 219 #} 213 220 } 214 221 else 215 222 { 216 &FileUtils::printError('Unknown mode requested: ' . $mode);223 $error_message = 'Unknown mode requested: ' . $mode; 217 224 } 218 225 if (!-e $dest) 219 226 { 220 &FileUtils::printWarning('linkFile', 'Link failed. Attempting to copy instead.'); 227 # Determine the top source path 228 my ($src_root) = $src =~ /^([a-z]:\\|\/[^\/]+)/i; 229 # If we haven't warned about this yet, warn now and record that we've 230 # warned. I want to let the user know what has happened, but without 231 # bombarding them with a thousand warning messages... 232 if (!defined $paths_we_cannot_link_from->{$src_root}) 233 { 234 &FileUtils::printWarning($error_message . '. Will attempt to copy from: ' . $src_root); 235 $paths_we_cannot_link_from->{$src_root} = 1; 236 } 221 237 &File::Copy::copy ($src, $dest); 222 238 }
Note:
See TracChangeset
for help on using the changeset viewer.