Page 1 of 1

Is it possible to make a file explorer?

Posted: Sat Nov 23, 2019 4:23 am
by TypicalHB
Hello, I would like to know if it is possible to make a file explorer of some kind so that players could, for example, change their avatar picture to a picture on their pc.

Re: Is it possible to make a file explorer?

Posted: Sat Nov 23, 2019 4:52 am
by raidho36
This is not possible without hacking into C++ side of the engine (or hooking up external C++ libraries).

You can however load files and directories that user drops onto game window, accessible through appropriate callbacks.

Re: Is it possible to make a file explorer?

Posted: Sat Nov 23, 2019 5:07 am
by zorg
It is totally possible without touching the C++ side... but it's not simple.

There are a few ways to access the filesystem apart from the love.filesystem stuff (lua's own io which has quite some limitations, using luafilesystem which requires binaries, or using my soon to be released lib which cheats quite a bit and (ab)uses both PhysFS that love.filesystem uses and OS-specific utils at least on windows to use wide-char filesystem functions... on top of any of these can people make their own explorer classes.

Re: Is it possible to make a file explorer?

Posted: Sat Nov 23, 2019 3:12 pm
by raidho36
zorg wrote: Sat Nov 23, 2019 5:07 am It is totally possible without touching the C++ side... but it's not simple.

There are a few ways to access the filesystem apart from the love.filesystem stuff (lua's own io which has quite some limitations, using luafilesystem which requires binaries, or using my soon to be released lib which cheats quite a bit and (ab)uses both PhysFS that love.filesystem uses and OS-specific utils at least on windows to use wide-char filesystem functions... on top of any of these can people make their own explorer classes.
So it's totally possible without touching the C++ side, by riding heavily on the C++ side. :crazy:

Re: Is it possible to make a file explorer?

Posted: Sat Nov 23, 2019 7:01 pm
by zorg
raidho36 wrote: Sat Nov 23, 2019 3:12 pm So it's totally possible without touching the C++ side, by riding heavily on the C++ side. :crazy:
You ain't touching the C++ side if someone else already done did it for ya :3
(man pointing to his head dot jpeg)
In any case, i would state that writing such things are very error prone, so for beginners i'd recommend against writing their own... hence the case i made for using others' stuff.
Apologies for no examples though, but mine's not yet complete, and the others have minute issues imo so i didn't want to link any.

Re: Is it possible to make a file explorer?

Posted: Sat Nov 23, 2019 9:50 pm
by monolifed
Quite possible but for a random location (that is outside love's reach) you might need to use a lua library to get files in a folder.
Another option is calling system commands like find/ls/dir via popen and capturing their output.

Re: Is it possible to make a file explorer?

Posted: Tue Jan 07, 2020 8:03 am
by HDPLocust
It's simple task using ffi-luafilesystem reimplementation like this: https://github.com/3scale/luafilesystem ... fs_ffi.lua.
No binaries, also it can read/write utf8-names instead of default lfs on windows, that can be very useful.