mirror of
				https://github.com/janet-lang/janet
				synced 2025-10-30 15:13:03 +00:00 
			
		
		
		
	Update module/paths for saner defaults.
Relative imports will only check the paths directly concerning relative imports.
This commit is contained in:
		| @@ -1580,6 +1580,7 @@ | |||||||
|  |  | ||||||
| (def- nati (if (= :windows (os/which)) ".dll" ".so")) | (def- nati (if (= :windows (os/which)) ".dll" ".so")) | ||||||
| (defn- check-. [x] (string/has-prefix? "." x)) | (defn- check-. [x] (string/has-prefix? "." x)) | ||||||
|  | (defn- not-check-. [x] (not (string/has-prefix? "." x))) | ||||||
|  |  | ||||||
| (def module/paths | (def module/paths | ||||||
|   "The list of paths to look for modules, templated for module/expand-path. |   "The list of paths to look for modules, templated for module/expand-path. | ||||||
| @@ -1597,16 +1598,16 @@ | |||||||
|     [(string ":cur:/:all:" nati) :native check-.] |     [(string ":cur:/:all:" nati) :native check-.] | ||||||
|  |  | ||||||
|     # As a path from (os/cwd) |     # As a path from (os/cwd) | ||||||
|     [":all:.janet" :source] |     [":all:.janet" :source not-check-.] | ||||||
|     [":all:/init.janet" :source] |     [":all:/init.janet" :source not-check-.] | ||||||
|     [":all:.jimage" :image] |     [":all:.jimage" :image not-check-.] | ||||||
|     [(string ":all:" nati) :native] |     [(string ":all:" nati) :native not-check-.] | ||||||
|  |  | ||||||
|     # System paths |     # System paths | ||||||
|     [":sys:/:all:.janet" :source] |     [":sys:/:all:.janet" :source not-check-.] | ||||||
|     [":sys:/:all:/init.janet" :source] |     [":sys:/:all:/init.janet" :source not-check-.] | ||||||
|     [":sys:/:all:.jimage" :image] |     [":sys:/:all:.jimage" :image not-check-.] | ||||||
|     [(string ":sys:/:all:" nati) :native]]) |     [(string ":sys:/:all:" nati) :native not-check-.]]) | ||||||
|  |  | ||||||
| (setdyn :syspath (process/opts "JANET_PATH")) | (setdyn :syspath (process/opts "JANET_PATH")) | ||||||
| (setdyn :headerpath (process/opts "JANET_HEADERPATH")) | (setdyn :headerpath (process/opts "JANET_HEADERPATH")) | ||||||
| @@ -1663,6 +1664,7 @@ | |||||||
| (put _env 'nati nil) | (put _env 'nati nil) | ||||||
| (put _env 'mod-filter nil) | (put _env 'mod-filter nil) | ||||||
| (put _env 'check-. nil) | (put _env 'check-. nil) | ||||||
|  | (put _env 'not-check-. nil) | ||||||
|  |  | ||||||
| (def module/cache | (def module/cache | ||||||
|   "Table mapping loaded module identifiers to their environments." |   "Table mapping loaded module identifiers to their environments." | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Calvin Rose
					Calvin Rose