Filesystem issues.

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
nullbear
Prole
Posts: 7
Joined: Fri Oct 24, 2014 2:26 am

Filesystem issues.

Post by nullbear »

Not sure if i should be posting this in this board, or the other one, or what to call this even, but anyways...

I have a VERY simple love file, the contents are a main.lua file, who's code is just:

love.filesystem.write("options.cfg", "test")

Nothing happens.

I've attempted a few variations, including adding the third argument: all and changing the path to "/options.cfg" and still, no go. How do i go about making a file in the same directory as the .love file?
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Filesystem issues.

Post by Jasoco »

I wouldn't recommend that. Let Löve put its file where it wants to. Which is in your AppData folder on Windows or the Library/Application Support/ folder on OS X. It's generally not recommended to dive into the os.* functions in Löve since they A) can change at any time and B) work differently across platforms.

Is there a reason you want to put it in the same directory? I can't think of any reason you can't just store any data in the proper location.
User avatar
nullbear
Prole
Posts: 7
Joined: Fri Oct 24, 2014 2:26 am

Re: Filesystem issues.

Post by nullbear »

Ey, that was all i needed to know. The wiki doesnt say, at least from what i saw, that it will save files to app data.
User avatar
Jasoco
Inner party member
Posts: 3727
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Filesystem issues.

Post by Jasoco »

Here you go:

http://www.love2d.org/wiki/love.filesystem

Explains everything including where the files will be put.
Windows XP: C:\Documents and Settings\user\Application Data\LOVE\ or %appdata%\LOVE\
Windows Vista and 7: C:\Users\user\AppData\Roaming\LOVE or %appdata%\LOVE\
Linux: $XDG_DATA_HOME/love/ or ~/.local/share/love/
Mac: /Users/user/Library/Application Support/LOVE/

It is recommended to set your game's identity first in your conf.lua. You can set it with love.filesystem.setIdentity() as well.
By setting the identity, you give a name to the folder the files will go in.
Post Reply

Who is online

Users browsing this forum: pgimeno, Semrush [Bot] and 2 guests