(notonline)-->
without js -- file i/o
procedure test(string filename)
string msg
switch get_file_type(filename) do
case FILETYPE_UNDEFINED: msg = "is UNDEFINED"
case FILETYPE_NOT_FOUND: msg = "is NOT_FOUND"
case FILETYPE_FILE: msg = "is a FILE"
case FILETYPE_DIRECTORY:
integer count = length(filter(vslice(dir(filename),D_NAME),"out",{".",".."}))
msg = iff(count=0?"is an empty directory"
:sprintf("is a directory containing %d files",{count}))
end switch
printf(1,"%s %s\n",{filename,msg})
end procedure
constant tests = {"C:\\xx","C:\\not_there","C:\\Program Files (x86)\\Phix\\p.exe","C:\\Windows"}
for i=1 to length(tests) do
test(tests[i])
end for