Page 3 of 3

Re: Enumerate files outside of root / save directory, recursively

Posted: Fri Feb 16, 2018 5:15 pm
by zorg
pgimeno wrote: Fri Feb 16, 2018 3:18 pm
zorg wrote: Fri Feb 16, 2018 12:05 pmIf this only happens because you tried to do ffi.load("love") then you missed the fact that on linux, you don't do that.
I was just objecting to coffeecat's proposal to always load love:
coffeecat wrote: Fri Feb 16, 2018 3:08 amThis semantics is probably related to the fact that "Windows symbols are bound to a specific DLL name", while symbols in POSIX systems aren't.

I think the best practice is to always use ffi.load("love"). It's an already loaded dynamic library, and each dynamic library is loaded at most one time for one executable. Therefore ffi.load("love") does no actual loading.
Ah, in that case, you are right, but...
pgimeno wrote: Fri Feb 16, 2018 3:18 pm The best thing to do may be to pcall ffi.C.PHYSFS_mount and try to load love only if that fails.
...I still disagree with this one; the snippet i reposted should fix all problems without needing to call ffi.C.PhysFS_mount more than once and check whether it failed.

Re: Enumerate files outside of root / save directory, recursively

Posted: Fri Feb 16, 2018 5:38 pm
by pgimeno
zorg wrote: Fri Feb 16, 2018 5:15 pm...I still disagree with this one; the snippet i reposted should fix all problems without needing to call ffi.C.PhysFS_mount more than once and check whether it failed.
... assuming the Windows version is not statically linked like my Linux versions are.

I didn't suggest calling it, just trying to access the symbol, i.e. something like: ok = pcall(function() return ffi.C.PHYSFS_mount end)

Edit: But again, that's the second-best option. The best option would be for the engine's love.filesystem.mount to not block any directories in the first place.

Re: Enumerate files outside of root / save directory, recursively

Posted: Sat Feb 17, 2018 2:18 am
by zorg
pgimeno wrote: Fri Feb 16, 2018 5:38 pm
zorg wrote: Fri Feb 16, 2018 5:15 pm...I still disagree with this one; the snippet i reposted should fix all problems without needing to call ffi.C.PhysFS_mount more than once and check whether it failed.
... assuming the Windows version is not statically linked like my Linux versions are.

I didn't suggest calling it, just trying to access the symbol, i.e. something like: ok = pcall(function() return ffi.C.PHYSFS_mount end)

Edit: But again, that's the second-best option. The best option would be for the engine's love.filesystem.mount to not block any directories in the first place.
I can understand the safety checks, but yes, it does make me need to redefine löve functions i wouldn't want to touch if i wanted to circumvent the limits.