From f0cac5c8f264a866708a7e67e621db492dbc4edc Mon Sep 17 00:00:00 2001 From: urlysses Date: Sat, 18 Feb 2017 09:46:33 -0500 Subject: [PATCH] Fix bug where repeat invocations of sourcedir returned different results (due to abuse of sourcefilename memore address) --- 1991.fs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/1991.fs b/1991.fs index 1914a47..d978fb0 100644 --- a/1991.fs +++ b/1991.fs @@ -19,9 +19,11 @@ include unix/socket.fs \ Useful for specifying in which dir to find \ specific files (e.g., public/, views/). sourcefilename \ get the name of our file + pad dup >r place \ copy the string so we don't + r> count \ modify sourcefilename. 2dup reverse \ reverse and search for first / s" /" search if \ if found, reverse string to - 2dup reverse \ to strip the filename but keep dir. + 2dup reverse \ strip the filename but keep dir. else 2drop \ no slash, s" ./" \ same dir execution.