Ver código fonte

Fix bug where repeat invocations of sourcedir returned different results (due to abuse of sourcefilename memore address)

1991
urlysses 7 anos atrás
pai
commit
f0cac5c8f2
1 arquivos alterados com 3 adições e 1 exclusões
  1. +3
    -1
      1991.fs

+ 3
- 1
1991.fs Ver arquivo

@@ -19,9 +19,11 @@ include unix/socket.fs
\ Useful for specifying in which dir to find \ Useful for specifying in which dir to find
\ specific files (e.g., public/, views/). \ specific files (e.g., public/, views/).
sourcefilename \ get the name of our file 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 / 2dup reverse \ reverse and search for first /
s" /" search if \ if found, reverse string to 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 else
2drop \ no slash, 2drop \ no slash,
s" ./" \ same dir execution. s" ./" \ same dir execution.


Carregando…
Cancelar
Salvar