File tree Expand file tree Collapse file tree 1 file changed +17
-15
lines changed
Expand file tree Collapse file tree 1 file changed +17
-15
lines changed Original file line number Diff line number Diff line change @@ -2021,29 +2021,31 @@ VARIABLE SCR
20212021\ (S: <spaces>name -- )
20222022: file-path CREATE 0 , 0 , path_max ALLOT DOES> @+ ;
20232023
2024- \ (S: sd.path xt -- )
2025- : set-file-path
2026- OVER 0 path_max 1- WITHIN 0= -11 AND THROW \ S: s u xt
2027- EXECUTE DROP SWAP \ S: s d u
2028- 2>R 2R@ \ S: s d u R: d u
2029- strncpy R> R> CELL- \ S: u d' R: --
2030- ! \ S: --
2031- ; $30 _pp!
2024+ \ (S: -- sd.path )
2025+ file-path default-base-path
2026+
2027+ \ Save the default-base-path to the current working directory.
2028+ getcwd default-base-path DROP CELL- ! DUP default-base-path strncpy FREE DROP
2029+
2030+ 2variable (source-base-path)
20322031
20332032\ (S: -- sd.path )
2034- file-path source-base-path
2033+ : source-base-path
2034+ (source-base-path) 2@ dup if exit then 2drop
2035+ default-base-path
2036+ ;
20352037
20362038\ (S: -- sd.path )
20372039: source-path _input_ptr @ in.path @ DUP strlen ; $02 _pp!
20382040
2039- \ (S: sd.path -- )
2040- : set-source-base-path ['] source-base-path set-file-path ; $20 _pp!
2041-
20422041\ (S: i*x xt sd.path -- j*x )
20432042: apply-base-path
2044- source-base-path strndup 2>r set-source-base-path
2045- catch
2046- 2r> 2dup set-source-base-path drop free drop throw
2043+ \ NB: resolving sd.path against source-base-path is missing
2044+ (source-base-path) 2@ 2>r
2045+ strndup over >r (source-base-path) 2!
2046+ catch
2047+ r> free drop
2048+ 2r> (source-base-path) 2! throw
20472049; $30 _pp!
20482050
20492051\ (S: i*x fd caddr u -- j*x )
You can’t perform that action at this time.
0 commit comments