Page 1 of 1

love.filesystem.load() behavior

Posted: Thu Mar 07, 2013 9:52 pm
by monsieur_h
Hey,

I use love.filesystem.load() to load my levels on the fly. My level files are located at the path : "data/levels/" inside of my love archive. Most of time I test my prototype without zipping it to a .love file, and everything works fine.

Recently, I tried to run my .love file on a windows computer and I got a file not found error when invoking the following line:

Code: Select all

love.filesystem.load( "data/levels/level_0" )
Notice that my level files have no extension, on purpose.


While reading the wiki (http://www.love2d.org/wiki/love.filesystem) I saw :
This module provides access to files in two places, and two places only:

The root folder of the .love archive (or source directory)
The root folder of the game's save directory.
Does it means that I can't access subfolders of my love archive? If not, what did I do wrong?

I also tried backslashes instead of slashes, and also adding a / before my path (e.g. /data/levels/level_0 ) and it didn't help.

Re: love.filesystem.load() behavior

Posted: Thu Mar 07, 2013 11:44 pm
by Jasoco
No, you can. I am wondering if it's because you have no extensions. Is there a reason for that? Why can't you use an extension?

love.filesystem will allow access to any folder within that root folder. I guess it should be worded better.

Try putting an extension on and see if it still errors.

Re: love.filesystem.load() behavior

Posted: Fri Mar 08, 2013 3:46 am
by Boolsheet
monsieur_h wrote:If not, what did I do wrong?
It really would be much easier if you upload an example that does not work for you. Throwing guesses around is so inefficient. :(
monsieur_h wrote:I also tried backslashes instead of slashes, and also adding a / before my path (e.g. /data/levels/level_0 ) and it didn't help.
Yeah, don't use backslashes. Using a slash for the first characters has the same effect as leaving it out; feel free to use whichever you like more. ;)

Re: love.filesystem.load() behavior

Posted: Fri Mar 08, 2013 11:16 am
by monsieur_h
Thank you for you answers.
Jasoco wrote:No, you can. I am wondering if it's because you have no extensions. Is there a reason for that? Why can't you use an extension?
It's not that I can't, it's just that I didn't need to. Gotta try with one soon.
Boolsheet wrote: It really would be much easier if you upload an example that does not work for you. Throwing guesses around is so inefficient. :(
My bad, I was in a rush and didn't took time to make an example. :roll: I'll try to append an extension to my file and if I still struggle, I'll take the time to post a clean .love file.

Also, I should've put this thread in Support and Development instead of General.

Re: love.filesystem.load() behavior

Posted: Fri Mar 08, 2013 2:22 pm
by spectralcanine
It doesn't matter if a file has an extension or not, it's just syntactic sugar to help common users.
Upload an actual example that doesn't work, because it certainly works for me.

Re: love.filesystem.load() behavior

Posted: Fri Mar 08, 2013 11:57 pm
by Jasoco
Hmm, yeah. We're gonna need a sample. If extensions don't matter. (I just don't like having un-extensioned files. Guess it stems from my DOS/Windows days)