Is it possible to make a file explorer?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
TypicalHB
Prole
Posts: 8
Joined: Sat Nov 23, 2019 4:20 am

Is it possible to make a file explorer?

Post 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.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Is it possible to make a file explorer?

Post 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.
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Is it possible to make a file explorer?

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Is it possible to make a file explorer?

Post 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:
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Is it possible to make a file explorer?

Post 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.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
monolifed
Party member
Posts: 188
Joined: Sat Feb 06, 2016 9:42 pm

Re: Is it possible to make a file explorer?

Post 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.
User avatar
HDPLocust
Citizen
Posts: 65
Joined: Thu Feb 19, 2015 10:56 pm
Location: Swamp
Contact:

Re: Is it possible to make a file explorer?

Post 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.
Science and violence
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 0 guests