Skip to content
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

Time to deprecate lfs.rmdir? #4

Closed
rrthomas opened this issue Jun 1, 2011 · 4 comments
Closed

Time to deprecate lfs.rmdir? #4

rrthomas opened this issue Jun 1, 2011 · 4 comments

Comments

@rrthomas
Copy link
Contributor

rrthomas commented Jun 1, 2011

(In favour of os.remove, which since 5.0 has acquired the ability to remove empty directories too; it would even be possible to do

lfs.rmdir = os.remove

Given that os.remove removes both files and directories, it seems pointless to keep a function that removes only directories, especially when there is no function which removes only files, either in core Lua or LFS.)

@mascarenhas
Copy link
Contributor

Calling os.remove on directories does not work on all platforms. It fails for me on Windows 7 with "Permission denied", for example, where lfs.rmdir works fine, so I think it should stay as it is.

@rrthomas
Copy link
Contributor Author

rrthomas commented Jun 8, 2011

I agree with you, but in that case it's worth documenting, perhaps in more general terms, something like "Although lfs.rmdir is logically the same as os.remove applied to an empty directory, lfs.rmdir is known to work in situations in which os.remove does not."

@mascarenhas
Copy link
Contributor

Actually os.remove just calls the underlying system remove. For POSIX remove is unlink for files and rmdir for directories, but for Windows the behavior is different: http://msdn.microsoft.com/en-us/library/2da4hk1d(v=VS.100).aspx. I guess the problem is with the documentation of os.remove. :-)

@rrthomas
Copy link
Contributor Author

rrthomas commented Jun 8, 2011

Agreed.

justinmk added a commit to justinmk/neovim that referenced this issue Sep 20, 2016
os.remove() fails on empty directories in non-POSIX systems.
lunarmodules/luafilesystem#4

lfs.rmdir() "usually" works, so use it instead.

Closes neovim#5236
justinmk added a commit to justinmk/neovim that referenced this issue Sep 20, 2016
os.remove() fails on empty directories in non-POSIX systems.
lunarmodules/luafilesystem#4

lfs.rmdir() "usually" works, so use it instead.

Closes neovim#5236
justinmk added a commit to justinmk/neovim that referenced this issue Sep 20, 2016
os.remove() fails on empty directories in non-POSIX systems.
lunarmodules/luafilesystem#4

lfs.rmdir() "usually" works, so use it instead.

Closes neovim#5236
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants