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: 17
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 » Sat Jun 13, 2020 2:41 pm

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: 2179
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 » Sat Jun 13, 2020 3:22 pm

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: 17
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 » Sat Jun 20, 2020 7:48 pm

Thank you for your very clear and simple answer !

User avatar
ReFreezed
Party member
Posts: 118
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 » Sat Jun 20, 2020 8:05 pm

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
Games: Momento Temporis: Light from the Deep, Momento Temporis: Arena, Energize!
"If each mistake being made is a new one, then progress is being made."

User avatar
Harrylechienfou
Prole
Posts: 17
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 » Sat Jun 20, 2020 8:54 pm

Ok, I'll take a look at it, thanks !

User avatar
AuahDark
Prole
Posts: 47
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 » 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.
Profile. I don't always online in forum, so Discord is preferred. Am I LÖVE for Android dev or not? Only you can tell.

User avatar
zorg
Party member
Posts: 2918
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 » Sat Jun 27, 2020 6:14 pm

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
Prole
Posts: 47
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 » Sun Jun 28, 2020 3:12 am

Do you even try that?
Profile. I don't always online in forum, so Discord is preferred. Am I LÖVE for Android dev or not? Only you can tell.

User avatar
ReFreezed
Party member
Posts: 118
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 » Sun Jun 28, 2020 7:19 am

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
Games: Momento Temporis: Light from the Deep, Momento Temporis: Arena, Energize!
"If each mistake being made is a new one, then progress is being made."

User avatar
zorg
Party member
Posts: 2918
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 » Sun Jun 28, 2020 7:25 am

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] and 14 guests