Page 1 of 2

Require error after zipping folder into .love file

Posted: Thu Jan 27, 2011 7:22 am
by slime
My code runs fine when I run the folder through the Love exe (windows), however when I zip it (and rename it to a .love file), it gives an error about being unable to find module "middleclass.init" (which I am using in my code). The error does not occur when I place my .love file inside my game's directory.

Am I doing it wrong?

Re: Require error after zipping folder into .love file

Posted: Thu Jan 27, 2011 8:53 am
by Taehl
Make sure your filepaths are written UNIX-style. You didn't use backslashes ("\") instead of forwardslashes ("/"), did you?

Re: Require error after zipping folder into .love file

Posted: Thu Jan 27, 2011 8:54 am
by kikito
Also, make sure your filenames have exactly the same case.

If you require 'Foo.lua' inside windows, but the file is called foo.lua, it will work on windows uncompressed, but once you zip that, it'll stop working.

Re: Require error after zipping folder into .love file

Posted: Thu Jan 27, 2011 2:14 pm
by Robin
It's none of those. I've looked at the code, and it only wants to run if LÖVE can find middleclass in the current directory. I don't know whether it's Lua's fault, or LÖVE's, or perhaps even Middleclass's, but slime's code seems to be clear.

Re: Require error after zipping folder into .love file

Posted: Thu Jan 27, 2011 3:26 pm
by miko
Looks like physfs bug:

Code: Select all

$ test_physfs
> mount spacegame2.love / 0
Successful.
> ls /
...
middleclass
middleclass-extras
..
 total (14) files.
> ls middleclass

BSD-LICENSE.txt
README.textile
init.lua
middleclass.lua
 total (4) files.
> exists middleclass/init.lua
File does not exists.
> exists middleclass-extras/init.lua
File exists.
If you rename middleclass-extras to xiddleclass-extras (and change main.lua accordingly) then everything works OK.
Should by reported upstream. I think physfs does not like directories with similar names.

Re: Require error after zipping folder into .love file

Posted: Thu Jan 27, 2011 4:29 pm
by bartbes
Now that I think of it.. maybe physfs uses 8.3-style name matching? I say this because this isn't the first time we stumbled upon this, and if it only checks the first 8 or 11 characters it would make a lot more sense.

Re: Require error after zipping folder into .love file

Posted: Thu Jan 27, 2011 4:45 pm
by TechnoCat
bartbes wrote:Now that I think of it.. maybe physfs uses 8.3-style name matching? I say this because this isn't the first time we stumbled upon this, and if it only checks the first 8 or 11 characters it would make a lot more sense.
Debugging these errors could be a nightmare then. No way to tell what is really happening.

Re: Require error after zipping folder into .love file

Posted: Thu Jan 27, 2011 5:01 pm
by slime
miko wrote:Looks like physfs bug:

Code: Select all

...
If you rename middleclass-extras to xiddleclass-extras (and change main.lua accordingly) then everything works OK.
Should by reported upstream. I think physfs does not like directories with similar names.
Alright thanks, changing the name did the trick.

Re: Require error after zipping folder into .love file

Posted: Thu Jan 27, 2011 5:14 pm
by kikito
This is weird.

I mean, middleclass-extras has been already used in other .love files, hasn't it?

Re: Require error after zipping folder into .love file

Posted: Thu Jan 27, 2011 5:33 pm
by TechnoCat
kikito wrote:This is weird.

I mean, middleclass-extras has been already used in other .love files, hasn't it?
I just drop anything I use in middleclass-extras/ into libs/middleclass/ to be honest.