Skip to content

Commit

Permalink
support compressed files in PageSource (#5880)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBreuer authored Jan 1, 2025
1 parent f578ffa commit 8cbb303
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/methwhy.g
Original file line number Diff line number Diff line change
Expand Up @@ -534,10 +534,15 @@ BIND_GLOBAL("PageSource", function ( fun, nr... )
else
Print( "Source not available.\n" );
fi;
elif not (IsExistingFile(f) and IsReadableFile(f)) then
Print( "Cannot access code from file \"",f,"\".\n");
else
if not IsExistingFile(f) and IsExistingFile(Concatenation(f, ".gz")) then
f:= Concatenation(f, ".gz");
fi;
if not (IsExistingFile(f) and IsReadableFile(f)) then
Print( "Cannot access code from file \"",f,"\".\n");
else
Print( "Showing source in ", f, " (from line ", l, ")\n" );
Pager(rec(lines := StringFile(f), formatted := true, start := l));
fi;
fi;
end);

0 comments on commit 8cbb303

Please sign in to comment.