Hey, looking for some help.
I need to load a file outside the .love folder (basically an .ini file that allows the user to configure some stuff outside the game). I'll be compiling to an .exe, but the user needs to be able to edit this file, so it's got to go outside the project directory. The file just shares a folder with the .love (or complied .exe) so I was pretty stumped when "../filename" didn't locate it, so I did some digging around and apparently Love has issues loading stuff that's not in the project directory, or the write directory... and I can't specify the file path for the write directory, just a name?
Would it be possible to set the write directory to some known location (ideally the folder that contains the .exe) so it can read the .ini from there? Or is there something more obvious that I'm missing?
Thanks.
Loading files outside the .love file
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- tentus
- Inner party member
- Posts: 1060
- Joined: Sun Oct 31, 2010 7:56 pm
- Location: Appalachia
- Contact:
Re: Loading files outside the .love file
From the wiki:
This is mostly for security reasons. Also, we've been getting a lot of questions about ini files recently... just so you know, .lua files make more sense, though it really is just semantics.Each game is granted a single directory on the system where files can be saved through love.filesystem. This is the only directory where love.filesystem can write files.
Kurosuke needs beta testers
Re: Loading files outside the .love file
Security reasons? Well, anyway, is it possible to set up the write directory so that it contains the project folder? That is, the write directory would be the folder that is distributed, and it would contain the .exe and also the .ini to read data from? I can't really work out where the write directory is located and how to specify it's path.
Also, I was sure I posted this on the development board! Can it be moved?
Also, I was sure I posted this on the development board! Can it be moved?
Re: Loading files outside the .love file
Writing to the actual game folder is a bad idea on any platform that isn't Windows XP.
You need administrator rights to write to that folder on any other system. Storing data in appdata is what appdata is there for.
You need administrator rights to write to that folder on any other system. Storing data in appdata is what appdata is there for.
Who is online
Users browsing this forum: Google [Bot] and 6 guests