Page 1 of 1

Create a desktop application with LÖVE : how to export files in a chose location ?

Posted: Sat Jun 13, 2020 2:41 pm
by Harrylechienfou
Hi fellow löve users !
I have the project to create a desktop application and since I’m in love with Lua and Love and in the contrary confused with oriented object programming and other framework, I have in mind to actually create it using Lua and Love2D. I know this is kind of stupid since it’s not what Love2D is made for, but unless I discover a simple framework to create desktop/web application with the same philosophy as Love2D, I think it’s not such a bad idea.
So, the application itself will be an application to generate content (mainly textual) and allow the user to edit it, and like any other application of this kind, save it somewhere on his computer as a file that he can later load and edit etc.

Only problem is : the file you create and save using Love2D/Lua usually goes to a hidden directory on the computer. I know where this directory is, but the users won’t, so I was wondering if there is any solution to actually save the file somewhere else on the computer ? I know it work this way for obvious security reasons, but I wondered if that could be avoided ?

Also, do you think using Love2D to create a desktop application is actually a very bad idea ? If so, do you have a framework to create desktop/web application that uses a language similar to Lua ? By that, I mean functional programming and not oriented object programming ?

Thanks for the answers ;)

Re: Create a desktop application with LÖVE : how to export files in a chose location ?

Posted: Sat Jun 13, 2020 3:22 pm
by pgimeno
Using io.open, you can read/write files anywhere (as strings). There are also libraries to scan directories, open file dialogues and that kind of stuff.

About it being a good idea or not, it's a matter of opinion. Mine is that using OpenGL is a bit overkill for a normal desktop application, but that doesn't exclude it.

Re: Create a desktop application with LÖVE : how to export files in a chose location ?

Posted: Sat Jun 20, 2020 7:48 pm
by Harrylechienfou
Thank you for your very clear and simple answer !

Re: Create a desktop application with LÖVE : how to export files in a chose location ?

Posted: Sat Jun 20, 2020 8:05 pm
by ReFreezed
Note that io.open() is not made to take Unicode strings - at least not in Windows. I'd suggest looking at how the problem is solved in e.g. nativefs.

Re: Create a desktop application with LÖVE : how to export files in a chose location ?

Posted: Sat Jun 20, 2020 8:54 pm
by Harrylechienfou
Ok, I'll take a look at it, thanks !

Re: Create a desktop application with LÖVE : how to export files in a chose location ?

Posted: Sat Jun 27, 2020 2:56 pm
by AuahDark
For the unicode problem in io.open(), you can just slap https://gist.github.com/MikuAuahDark/d6 ... d710347ac0 and pass UTF-8 files.

Re: Create a desktop application with LÖVE : how to export files in a chose location ?

Posted: Sat Jun 27, 2020 6:14 pm
by zorg
AuahDark wrote: Sat Jun 27, 2020 2:56 pm For the unicode problem in io.open(), you can just slap https://gist.github.com/MikuAuahDark/d6 ... d710347ac0 and pass UTF-8 files.
Might not work on Win7 :p

Re: Create a desktop application with LÖVE : how to export files in a chose location ?

Posted: Sun Jun 28, 2020 3:12 am
by AuahDark
Do you even try that?

Re: Create a desktop application with LÖVE : how to export files in a chose location ?

Posted: Sun Jun 28, 2020 7:19 am
by ReFreezed
zorg wrote: Sat Jun 27, 2020 6:14 pm Might not work on Win7 :p
Seems to work for me on Windows 7. It doesn't look like the script is doing anything that shouldn't work on Windows Vista and later either.

Re: Create a desktop application with LÖVE : how to export files in a chose location ?

Posted: Sun Jun 28, 2020 7:25 am
by zorg
Yep, just tested, it did work; false alarm.