Page 1 of 1

dofile() in a .love file in a Mac App Bundle

Posted: Tue Feb 07, 2012 4:06 am
by JasonFruit
In my game (well, it's not a game, but that's irrelevant), I use

Code: Select all

dofile("ui.lua")
to load my UI library. It works fine when I do "love ." from the game folder, or if I zip it all up and do "love my-game.love".

When I build a Mac application bundle and put the .love file in my-game.app/Contents/Resources/my-game.love, however, it fails with the error:

Code: Select all

cannot open ui.lua: No such file or directory
Are relative paths not available the way the .love file is loaded in that situation? Is there another way to load the file?

Re: dofile() in a .love file in a Mac App Bundle

Posted: Tue Feb 07, 2012 4:12 am
by slime
Use

Code: Select all

require("ui")
or

Code: Select all

love.filesystem.load("ui.lua")()

Re: dofile() in a .love file in a Mac App Bundle

Posted: Tue Feb 07, 2012 4:17 am
by JasonFruit
I obey. Thank you for the assistance.

Re: dofile() in a .love file in a Mac App Bundle

Posted: Tue Feb 07, 2012 7:53 am
by bartbes
As to why dofile works for you, let me guess you're still in the same folder when you run the love?