# Make Love2D load resource from inside the .love file

I've just made my first (very simple, ugly) game in Love2D. The game works fine when run directly off my hard drive. However, when I package it up as a .love file, I get the following message:

Error: Could not open file resources/stormclouds.bmp. Does not exist.
stack traceback:
[C]: ?
[C]: in function 'newImage'
[string "boot.lua"]:304: in function <[string "boot.lua"]:302>
[C]: in function 'xpcall'

The "resources" folder does exist within my directory structure (resources/stormclouds.bmp), and the game runs fine when its not packaged up.

The line of code responsible for this is:

bg = love.graphics.newImage("resources/stormclouds.bmp")

How can I make this line work for my packaged file?

• You say that "resources" folder doesn't exist, but you still refer to it in code? What does the zip contents look like? There should be a resources directory in the zip and the .bmp file in the folder. – Jari Komppa Sep 22 '11 at 5:37
• Yes, you're right, this was what the problem was. I had used the command given on the Love2d website to zip up my folder(zip ../${PWD##*/}.love *), but this doesn't seem to include sub folder contents. Zipping using a different method did solve this problem. – a_m0d Sep 22 '11 at 10:23 • I'll formulate that into an answer.. – Jari Komppa Sep 22 '11 at 10:26 ## 1 Answer The .love files are actually renamed .zip files. These zip files contain directory structures, so if your code refers to, say, "foo/bar.dat", your zip file has to have a "foo" directory with the "bar.dat" contained within. See http://love2d.org/wiki/Game_Distribution for details. • Yes, I was aware of this. The problem is that I ran zip ../${PWD##*/}.love * instead of zip -r ../\${PWD##*/}.love *, which didn't recurse into sub folders. – a_m0d Sep 22 '11 at 13:31
• The form of the answer was more for the next person who's looking for the answer, and ends up on this page. =) – Jari Komppa Sep 22 '11 at 13:41