Skip to content

Commit

Permalink
PageSource should show local file
Browse files Browse the repository at this point in the history
So far, we assumed in PageSource that if FILENAME_FUNC returns a string not
starting with '/' that the pathname was relative to a GAP root. This is not
true if a function was read from a file relative to GAPs current directory.

Remark: It would be good to store a full path with function read from a
local file.
  • Loading branch information
frankluebeck authored and fingolfin committed Jul 5, 2018
1 parent 154d3c3 commit f37d802
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/methwhy.g
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,13 @@ BIND_GLOBAL("PageSource", function ( fun, nr... )
l := fail;
f := FILENAME_FUNC( fun );
if IsString(f) and Length(f)>0 and f[1] <> '/' then
if Length(f) > 7 and f{[1..8]} = "GAPROOT/" then
f := f{[9..Length(f)]};
# first assume it is a local path, otherwise look in GAP roots
if not IsReadableFile(f) then
if Length(f) > 7 and f{[1..8]} = "GAPROOT/" then
f := f{[9..Length(f)]};
fi;
f := Filename(List(GAPInfo.RootPaths, Directory), f);
fi;
f := Filename(List(GAPInfo.RootPaths, Directory), f);
fi;
if f = fail and fun in OPERATIONS then
# for operations we show the location(s) of their declaration
Expand Down

0 comments on commit f37d802

Please sign in to comment.