File system strangeness.

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Sslaxx
Citizen
Posts: 57
Joined: Sat Feb 14, 2009 8:54 pm
Location: Malvern, Worcs, UK
Contact:

File system strangeness.

Post by Sslaxx »

Now, my understanding is that this:

Code: Select all

 axel = love.filesystem.newFile ("A.B", love.file_write)
 if (love.filesystem.open (axel)) then
  love.filesystem.write (axel, playerInfo)
  love.filesystem.close (axel)
 end
will create an <application name> folder in (in this case) /home/stuart/.love.

However, it isn't. I'm getting this on the command line.
Command Line wrote:Could not create directory .love/.: Insecure filename
Error, could not open file:
Running "love ." creates the error. "love ../EggTester" works. Creating a .love file and running that works, too.

Perhaps in the former case a slightly more helpful error message might work?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: File system strangeness.

Post by bartbes »

It uses the first argument to love as program name, so if you have a .love the save dir is not the same as that of a folder. If you do love ., it tries to use ~/.love/., which as it says is insecure, so it doesn't do it.
User avatar
Sslaxx
Citizen
Posts: 57
Joined: Sat Feb 14, 2009 8:54 pm
Location: Malvern, Worcs, UK
Contact:

Re: File system strangeness.

Post by Sslaxx »

Yeah, I noticed. Perhaps LOVE could be made to put together the author and title strings from game.conf to create the directory it uses.

[EDIT: Dunno why I was blathering on about HOME/USERPROFILE...]
Last edited by Sslaxx on Sun Feb 15, 2009 1:40 pm, edited 1 time in total.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: File system strangeness.

Post by bartbes »

What do HOME and USERPROFILE have to do with this? It always stores in your home directory.

To make sure you understand what I wrote: ~ -> /home/<user>
Last edited by bartbes on Sun Feb 15, 2009 1:41 pm, edited 1 time in total.
User avatar
Sslaxx
Citizen
Posts: 57
Joined: Sat Feb 14, 2009 8:54 pm
Location: Malvern, Worcs, UK
Contact:

Re: File system strangeness.

Post by Sslaxx »

If LOVE used Author+Title instead of directory/file name then "love ." would work (why it doesn't anyway is because of the way LOVE sets up directories).
User avatar
rude
Administrator
Posts: 1052
Joined: Mon Feb 04, 2008 3:58 pm
Location: Oslo, Norway

Re: File system strangeness.

Post by rude »

Hmm. Never thought of that. How should this be dealt with? Should people be allowed to choose the write directory? (%APPDATA%/chosen, not /chosen/chosen/chosen).

Just using the filename seemed like a good idea until now. True, developers can choose the write directory via the filename, but at least the user will know which directory the game has access to just be looking at the file.

We've discussed several solutions to this ages ago, but I remember only poor ones.

Suggestions plz.
User avatar
Sslaxx
Citizen
Posts: 57
Joined: Sat Feb 14, 2009 8:54 pm
Location: Malvern, Worcs, UK
Contact:

Re: File system strangeness.

Post by Sslaxx »

People who're going to be looking in a directory like $HOME/.love/appname are going to be a little bit more tech-savvy and going to look into a .love file anyway. If they see that the author is Joe Bloggs and the game's name is Death of Invaders, then a directory called "Joe Bloggs - Death of Invaders" inside $HOME/.love can only be one thing...
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: File system strangeness.

Post by bartbes »

I agree with that, if you're looking for save files you don't have to expect a big yellow arrow pointing towards the file.
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: File system strangeness.

Post by osuf oboys »

rude wrote:Hmm. Never thought of that. How should this be dealt with? Should people be allowed to choose the write directory? (%APPDATA%/chosen, not /chosen/chosen/chosen).

Just using the filename seemed like a good idea until now. True, developers can choose the write directory via the filename, but at least the user will know which directory the game has access to just be looking at the file.

We've discussed several solutions to this ages ago, but I remember only poor ones.

Suggestions plz.
I believe one should be able to choose the LOVE application data directory or any subdirectory thereof, e.g. setSaveDirectory("snow_wars") (~> %APPDATA/love/snow_wars). If you a release of a game in two versions, or sequals - game.love and game.tgs.love, you may very well want them all to share data folders, or at least read from other versions'. Likewise, some games may want to have access to the data of other games, such as for importing save data from one game to another or a map editor used for different games.

Regardless of the above, I still believe that access to the everything accessible to the user should be accessible to the game, as is standard for applications. Reading would be a minimum, consider the almost mandatory feature of importing images of the user's liking. An option would be to, at the first trespass, present the user with a dialogue asking whether or not the game should be allowed to leave/write outside its data directories.
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
User avatar
Sslaxx
Citizen
Posts: 57
Joined: Sat Feb 14, 2009 8:54 pm
Location: Malvern, Worcs, UK
Contact:

Re: File system strangeness.

Post by Sslaxx »

One way of doing that could be to provide a "savedirectory" type option in game.conf, e.g.

Code: Select all

savedirectory = "MegaInvadersDeath Series Shared Stuff"
- if the player wanted to add custom stuff to the game, then the game itself should give the means to do this; being able to read the directory/files needed, but writes a copy in either its main app .love directory, or in a specified save directory within $HOME/.love.
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests