-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
lfs.dir does not raise an error for not existing path on Windows #39
Comments
Confirmed on Win10/VS2015, it returns an empty iterator. I think that current behaviour on other platforms (raising an error) is preferable. |
I vote it should raise error if there some real error e.g. access denied. But if path does not exists it shuld returns empty iterator. |
IMO if a directory you are trying to iterate over doesn't exist it's a real error, too, and it shouldn't be silently ignored. Let's see if there are any more opinions. |
I vote for consitent behaviour across platforms, so thow an error if it doesn't exist |
I think it should throw an error if the path does not exist; at least this is what I would expect to happen in any filesystem library. Returning an empty iterator makes it indistiguishable from an empty directory. |
The key problem here is that the To properly raise an error on invalid paths, the function should verify that the parameter really points to a directory. I've successfully implemented some proof-of-concept code in n1tehawk@9f70724. Regards, NiteHawk |
Any updates on this? Another place where errors can happen is in calling the iterator function: My proposal would be to return for f,err in lsf.dir(path) do
if not f then
print("error",err)
break
end
print("item is",f)
end |
See #132 (comment) |
lfs.dir
with not existing path raise error on *nix but not on Windows.I think error
path not found
/file not found
shold be considered not as error but just as empty resultset.At least it should be same on all platforms.
The text was updated successfully, but these errors were encountered: