From e473f8e066c989252fd1e21f9b440c2a933d3b5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lars=20G=C3=B6ttgens?= Date: Wed, 18 Dec 2024 12:04:29 +0100 Subject: [PATCH] Add cmd line arg --- lib/package.gi | 9 ++++++++- lib/system.g | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/package.gi b/lib/package.gi index 94f570d060..3b27a3ece5 100644 --- a/lib/package.gi +++ b/lib/package.gi @@ -286,7 +286,7 @@ end ); ## In earlier versions, this function had an argument; now we ignore it. ## InstallGlobalFunction( InitializePackagesInfoRecords, function( arg ) - local pkgdirs, pkgdir, ignore, name, files, record, r; + local pkgdirs, pkgdir, pkgdirstrs, ignore, name, files, record, r; if IsBound( GAPInfo.PackagesInfoInitialized ) and GAPInfo.PackagesInfoInitialized = true then @@ -301,6 +301,13 @@ InstallGlobalFunction( InitializePackagesInfoRecords, function( arg ) LogPackageLoadingMessage( PACKAGE_DEBUG, "entering InitializePackagesInfoRecords", "GAP" ); + # the first time this is called, add the cmd line args to the list + if IsEmpty(GAPInfo.PackageDirectories) then + for pkgdirstrs in GAPInfo.CommandLineOptions.packagedirs do + pkgdirs:= List( SplitString( pkgdirstrs, ";" ), Directory); + APPEND_LIST_INTR( GAPInfo.PackageDirectories, pkgdirs ); + od; + fi; # add any new pkg directories to the list pkgdirs:= DirectoriesLibrary( "pkg" ); if pkgdirs <> fail then diff --git a/lib/system.g b/lib/system.g index d63219bce8..f9bb0f3b35 100644 --- a/lib/system.g +++ b/lib/system.g @@ -95,6 +95,9 @@ BIND_GLOBAL( "GAPInfo", rec( "directories to the end/start of existing list", "of root paths" ] ), rec( short:= "r", default := false, help := ["disable/enable user GAP root dir", "GAPInfo.UserGapRoot"] ), + rec( long := "packagedirs", default := [], arg := "", + help := [ "set or modify the GAP directory paths", + "Directories are separated using ';'." ] ), , rec( section:= ["Loading:"] ), rec( short:= "A", default := false, help := ["disable/enable autoloading of suggested", "GAP packages"] ),