Skip to content

Commit

Permalink
Tidy up BindGlobals
Browse files Browse the repository at this point in the history
  • Loading branch information
mtorpey committed Sep 4, 2024
1 parent 9155c70 commit 42687fa
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
4 changes: 3 additions & 1 deletion gap/PackageManager.gd
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,9 @@ SetInfoLevel(InfoPackageManager, 3);
#! <K>true</K> or <K>false</K>
DeclareGlobalFunction("RemovePackage");

# Hidden functions
DeclareGlobalFunction("PKGMAN_CheckPackage");
DeclareGlobalFunction("PKGMAN_Exec");
DeclareGlobalFunction("PKGMAN_InfoWithIndent");
DeclareGlobalFunction("PKGMAN_PathSystemProgram");

BindGlobal("PKGMAN_WHITESPACE", MakeImmutable(" \n\t\r"));
27 changes: 13 additions & 14 deletions gap/PackageManager.gi
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,6 @@
# Implementations
#

BindGlobal("PKGMAN_WHITESPACE", MakeImmutable(" \n\t\r"));

BindGlobal("PKGMAN_PathSystemProgram", function(name)
local dir, path;

for dir in DirectoriesSystemPrograms() do
path:= Filename(dir, name);
if IsExecutableFile(path) then
return path;
fi;
od;
return fail;
end);

# Install fallback ChangeDirectoryCurrent if GAP is too old and io isn't loaded
if not IsBound(ChangeDirectoryCurrent) then
ChangeDirectoryCurrent := function(dir)
Expand Down Expand Up @@ -368,3 +354,16 @@ function(infoLevel, message, indentLevel)
Info(InfoPackageManager, infoLevel, indent, line);
od;
end);

InstallGlobalFunction(PKGMAN_PathSystemProgram,
function(name)
local dir, path;

for dir in DirectoriesSystemPrograms() do
path:= Filename(dir, name);
if IsExecutableFile(path) then
return path;
fi;
od;
return fail;
end);

0 comments on commit 42687fa

Please sign in to comment.