Require error after zipping folder into .love file

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.
User avatar
slime
Solid Snayke
Posts: 3142
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Require error after zipping folder into .love file

Post 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?
Attachments
spacegame.love
(186.05 KiB) Downloaded 95 times
User avatar
Taehl
Dreaming in associative arrays
Posts: 1025
Joined: Mon Jan 11, 2010 5:07 am
Location: CA, USA
Contact:

Re: Require error after zipping folder into .love file

Post by Taehl »

Make sure your filepaths are written UNIX-style. You didn't use backslashes ("\") instead of forwardslashes ("/"), did you?
Earliest Love2D supporter who can't Love anymore. Let me disable pixel shaders if I don't use them, dammit!
Lenovo Thinkpad X60 Tablet, built like a tank. But not fancy enough for Love2D 0.10.0+.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Require error after zipping folder into .love file

Post 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.
When I write def I mean function.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Require error after zipping folder into .love file

Post 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.
Help us help you: attach a .love.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Require error after zipping folder into .love file

Post 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.
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Require error after zipping folder into .love file

Post 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.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Require error after zipping folder into .love file

Post 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.
User avatar
slime
Solid Snayke
Posts: 3142
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Require error after zipping folder into .love file

Post 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.
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Require error after zipping folder into .love file

Post by kikito »

This is weird.

I mean, middleclass-extras has been already used in other .love files, hasn't it?
When I write def I mean function.
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Require error after zipping folder into .love file

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

Who is online

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