opendylan
opendylan copied to clipboard
do-directory crashes process when "." is passed as a directory argument
In the following code, you get a crash if you attempt to use "." as a pathname to the second argument to do-directory:
define function main (name :: <string>, arguments :: <vector>)
local method print-entry (dir :: <pathname>, filename :: <string>, type :: <file-type>)
format-out("%s\n", filename);
end;
do-directory(print-entry, ".");
exit-application(0);
end function main;
main(application-name(), application-arguments());
Crash:
No applicable method, applying {<sealed-generic-function>: do-directory} to {<simple-object-vector>: {<simple-closure-method>: ??? ({<union>: <string>, <file-system-locator>}, <string>, {<union>: {<union>: #"file", #"directory"}, #"link"})}, #f}.
No applicable method, applying {<sealed-generic-function> 0x4e8038} to #[{function 0xb3110}, #f].
Breaking into debugger.
[1] 43966 trace trap ./_build/bin/do-dir-test
Expected: this should work, and use the current working directory.
Replacing "." with working-directory() does work.