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

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
Harrylechienfou
Prole
Posts: 30
Joined: Tue May 21, 2019 2:02 pm

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

Post 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 ;)
User avatar
pgimeno
Party member
Posts: 3544
Joined: Sun Oct 18, 2015 2:58 pm

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

Post 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.
User avatar
Harrylechienfou
Prole
Posts: 30
Joined: Tue May 21, 2019 2:02 pm

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

Post by Harrylechienfou »

Thank you for your very clear and simple answer !
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

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

Post 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.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
User avatar
Harrylechienfou
Prole
Posts: 30
Joined: Tue May 21, 2019 2:02 pm

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

Post by Harrylechienfou »

Ok, I'll take a look at it, thanks !
User avatar
AuahDark
Party member
Posts: 107
Joined: Mon Oct 23, 2017 2:34 pm
Location: Indonesia
Contact:

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

Post 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.
Profile. Do you encounter crashes in LÖVE Android and wanna send me logcats? Please hit me up in LÖVE Discord and send the full logcat file!
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

Post 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
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
AuahDark
Party member
Posts: 107
Joined: Mon Oct 23, 2017 2:34 pm
Location: Indonesia
Contact:

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

Post by AuahDark »

Do you even try that?
Profile. Do you encounter crashes in LÖVE Android and wanna send me logcats? Please hit me up in LÖVE Discord and send the full logcat file!
User avatar
ReFreezed
Party member
Posts: 612
Joined: Sun Oct 25, 2015 11:32 pm
Location: Sweden
Contact:

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

Post 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.
Tools: Hot Particles, LuaPreprocess, InputField, (more) Games: Momento Temporis
"If each mistake being made is a new one, then progress is being made."
User avatar
zorg
Party member
Posts: 3436
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

Post by zorg »

Yep, just tested, it did work; false alarm.
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.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Hugues Ross and 43 guests