Browse Source

Hopefully, this properly fixes the relativing of dirs/files from

make_link_relative when it makes "absolutely" no sense.
master
freesource 24 years ago
parent
commit
c75586cf32
  1. 19
      BootRoot/Yard.pm

19
BootRoot/Yard.pm

@ -196,6 +196,7 @@ sub read_contents_file {
my($abs_file) = find_file_in_path($link); my($abs_file) = find_file_in_path($link);
$Included{$abs_file} = 1 if $abs_file; $Included{$abs_file} = 1 if $abs_file;
#### Have to be careful here. Record the rel link for use #### Have to be careful here. Record the rel link for use
#### in setting up the root fs, but use the abs_link in @files #### in setting up the root fs, but use the abs_link in @files
#### so next loop gets any actual files. #### so next loop gets any actual files.
@ -1331,13 +1332,27 @@ sub make_link_relative {
# It's absolute -- we have to relativize it # It's absolute -- we have to relativize it
# The abs_file guaranteed not to have any funny # The abs_file guaranteed not to have any funny
# stuff like "/./" or "/foo/../../bar" already in it. # stuff like "/./" or "/foo/../../bar" already in it.
$newlink = ("../" x path_length($abs_file)) . $1;
## This is an experimental solution to an annoying tendency
## for this to happen ../../../../ for files/dirs .. basically
## this occurs when called from include_file() called from
## extra_links() .. the reason for relativing links like this
## doesn't make sense.
if (!-f $link && !-d $link) {
$newlink = ("../" x path_length($abs_file)) . $1;
}
} else { } else {
# Already relative # Already relative
$newlink = $link; $newlink = $link;
} }
cleanup_link($newlink); if ($newlink) {
cleanup_link($newlink)
}
else {
return $link;
}
} }
} }

Loading…
Cancel
Save