274 elsif($tag=~/^(SystemDefinition|systemModel)$/ ) |
274 elsif($tag=~/^(SystemDefinition|systemModel)$/ ) |
275 { |
275 { |
276 } |
276 } |
277 elsif($tag eq 'unit') |
277 elsif($tag eq 'unit') |
278 { |
278 { |
279 foreach my $atr ('bldFile','mrp','base','proFile') |
279 foreach my $atr ('bldFile','mrp','base') |
280 { |
280 { |
281 my $link= $node->getAttribute($atr); |
281 my $link= $node->getAttribute($atr); |
282 if($link && !($link=~/^\//)) |
282 if($link && !($link=~/^\//)) |
283 { |
283 { |
284 $link= &abspath(File::Basename::dirname($file)."/$link"); |
284 $link= &abspath(File::Basename::dirname($file)."/$link"); |
285 foreach my $a (keys %rootmap) { |
285 foreach my $a (sort {length($b) - length($a)} keys(%rootmap)) { |
286 $link=~s,^$a,$rootmap{$a},ie; |
286 $link=~s,^$a,$rootmap{$a},ie; |
287 } |
287 } |
288 # remove leading ./ which is used to indicate that paths should remain relative |
288 # remove leading ./ which is used to indicate that paths should remain relative |
289 $link=~s,^\./([^/]),$1,; |
289 $link=~s,^\./([^/]),$1,; |
|
290 # remove windows drive letter -- only allow paths on the same drive. Use root attribuite to build across drives / filesystems |
|
291 $link=~s,^[a-z]:/,/,i; |
290 $node->setAttribute($atr,$link); |
292 $node->setAttribute($atr,$link); |
291 } |
293 } |
|
294 } |
|
295 if(scalar @{$node->getChildNodes()} && $maxschema=~/^3\.0/) |
|
296 { |
|
297 die "Error: Fatal syntax error in $file. Unit elements must be empty in schema $maxschema.\n"; |
292 } |
298 } |
293 } |
299 } |
294 elsif($tag eq 'meta') |
300 elsif($tag eq 'meta') |
295 { |
301 { |
296 my $rel= $node->getAttribute('rel') || 'Generic'; |
302 my $rel= $node->getAttribute('rel') || 'Generic'; |