luafilesystem
luafilesystem copied to clipboard
lfs declares a global
This is considered bad practice nowadays.
On the other hand, fixing this in the code may break a lot of stuff out there (with the trivial fix of changing require("lfs")
to local lfs = require("lfs")
).
Should we make this change in the code?
yes!
That would require a change in version. Bump the major to 2.
agreed
Sent from my iPhone
On 28 de fev de 2016, at 18:49, Ignacio Burgueño [email protected] wrote:
That would require a change in version. Bump the major to 2. — Reply to this email directly or view it on GitHub.
@ignacio Oh wow. If we're bumping lfs to 2.0, then we better take the opportunity to make any other API tweaks all at once :)
also something still missing I discussed a long time ago with @stevedonovan is a missing 'filecopy' function. The issue being that this cannot be done in pure Lua on Windows without an ugly dos box popping up. So would be nice to fit that in here as well.
@Tieske filecopy
as in copy file A to file B? can't it be done in pure Lua opening file A for reading and file B for writing and performing reads and writes in 64k blocks? That's what the cp
command does in C on Linux at least. I may be missing something (attributes?)
Hello If you speak about API... luafilesystem has most of the features that the other implementation/solution have. Except :
Regards,
readpath and readlink actually make sense on Windows these days, even though it isn't POSIX.
it seems POSIX...
man 2 readlink
CONFORMING TO
4.4BSD (readlink() first appeared in 4.2BSD), POSIX.1-2001.
man 3 realpath
CONFORMING TO
4.4BSD, POSIX.1-2001
I think @stevedonovan meant that Windows isn't posix.
filecopy as in copy file A to file B? can't it be done in pure Lua opening file A for reading and file B for writing and performing reads and writes in 64k blocks? That's what the cp command does in C on Linux at least. I may be missing something (attributes?)
Not sure anymore, what it exactly was. But performance is certainly one. @stevedonovan do you recall?
On Wed, Mar 2, 2016 at 7:18 PM, Thijs Schreijer [email protected] wrote:
I think @stevedonovan https://github.com/stevedonovan meant that Windows isn't posix.
Yes, and also that Windows NTFS supports both hard and soft links, so lfs.readlink can be implemented using the native API. Ditto for realpath.
On Thu, Mar 3, 2016 at 1:04 AM, Thijs Schreijer [email protected] wrote:
Not sure anymore, what it exactly was. But performance is certainly one. @stevedonovan https://github.com/stevedonovan do you recall?
Well, even cp does more than just copy - preserves permissions such as executable, etc. And Windows has attributes like read-only, archive, etc.
There's also an API call for copying files ;)
Removed th global on 2.0 branch.