@@ -32,6 +32,8 @@ Each list element starts with an operation name such as :test and is followed by
3232to invoke to implement that operation. When system :run is called with key values those keys
3333are bound to the values and are available to the function being called.
3434`
35+
36+ systemPathnameDoc = "Filepath to the component files."
3537)
3638
3739var system * flavors.Flavor
@@ -54,6 +56,7 @@ func defSystem() *flavors.Flavor {
5456 "components" : nil ,
5557 "in-order-to" : nil ,
5658 "cache" : nil ,
59+ "pathname" : nil ,
5760 },
5861 nil , // inherit
5962 slip.List { // options
@@ -64,7 +67,7 @@ func defSystem() *flavors.Flavor {
6467 slip .String (`Instances of this Flavor define a system similar to ASDF in common LISP
6568(https://asdf.common-lisp.dev) but with some differences. A __system__ instance
6669captures the information associated with a code that implements the
67- system. This includes providence variables such as author, version, and source
70+ system. This includes provenance variables such as author, version, and source
6871location to name a few.
6972
7073Some of the differences when compared to ASDF are:
@@ -75,13 +78,13 @@ Some of the differences when compared to ASDF are:
7578 - The :components variable only allows for files and not modules.
7679 - The :depends-on variable differs to support git and other system sources.
7780 - The :in-order-to variable differs although it serves the same purpose.
78- - The __system__ is a Flavor that also supports a :fetch method .
81+ - The __system__ is a Flavor that also supports :fetch and :load methods .
7982 - A :cache variable is included.
8083
8184
8285The usual use of a __system__ instance is to first send the instance a :fetch
83- method to cache sources and then invoke one of the operations defined in the
84- :in-order-to variable.
86+ method to cache sources, followed by :load, and then invoke one of the
87+ operations defined in the :in-order-to variable if desired .
8588
8689` ),
8790 },
@@ -92,6 +95,7 @@ method to cache sources and then invoke one of the operations defined in the
9295 system .DefMethod (":load" , "" , systemLoadCaller {})
9396 system .DefMethod (":run" , "" , systemRunCaller {})
9497
98+ system .Document ("pathname" , systemPathnameDoc )
9599 system .Document ("components" , systemComponentsDoc )
96100 system .Document ("cache" , systemCacheDoc )
97101 system .Document ("depends-on" , systemDependsOnDoc )
@@ -179,6 +183,10 @@ func (caller systemLoadCaller) Call(s *slip.Scope, args slip.List, depth int) sl
179183 }
180184 gc := self .Get ("components" )
181185 if gc != nil {
186+ dir := "."
187+ if pn , _ := self .Get ("pathname" ).(slip.String ); 0 < len (pn ) {
188+ dir = string (pn )
189+ }
182190 var components slip.List
183191 components , ok := gc .(slip.List )
184192 if ! ok {
@@ -189,11 +197,12 @@ func (caller systemLoadCaller) Call(s *slip.Scope, args slip.List, depth int) sl
189197 if path , ok = comp .(slip.String ); ! ok {
190198 slip .TypePanic (s , depth , "component" , comp , "string" )
191199 }
192- matches , _ := filepath .Glob (string (path ))
200+ compPath := filepath .Join (dir , string (path ))
201+ matches , _ := filepath .Glob (compPath )
193202 if len (matches ) == 0 {
194- matches , _ = filepath .Glob (string ( path ) + ".lisp" )
203+ matches , _ = filepath .Glob (compPath + ".lisp" )
195204 if len (matches ) == 0 {
196- slip .ErrorPanic (s , depth , "%s not found." , path )
205+ slip .ErrorPanic (s , depth , "%s.lisp not found." , compPath )
197206 }
198207 }
199208 for _ , m := range matches {
0 commit comments