love.filesystem.load() behavior

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
monsieur_h
Citizen
Posts: 65
Joined: Tue Oct 30, 2012 4:43 pm

love.filesystem.load() behavior

Post 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.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: love.filesystem.load() behavior

Post 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.
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: love.filesystem.load() behavior

Post 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. ;)
Shallow indentations.
User avatar
monsieur_h
Citizen
Posts: 65
Joined: Tue Oct 30, 2012 4:43 pm

Re: love.filesystem.load() behavior

Post 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.
spectralcanine
Citizen
Posts: 65
Joined: Sat Dec 22, 2012 8:17 am

Re: love.filesystem.load() behavior

Post 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.
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: love.filesystem.load() behavior

Post 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)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 249 guests