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

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
JasonFruit
Prole
Posts: 2
Joined: Tue Feb 07, 2012 3:51 am

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

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

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

Post by slime »

Use

Code: Select all

require("ui")
or

Code: Select all

love.filesystem.load("ui.lua")()
JasonFruit
Prole
Posts: 2
Joined: Tue Feb 07, 2012 3:51 am

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

Post by JasonFruit »

I obey. Thank you for the assistance.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

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

Post by bartbes »

As to why dofile works for you, let me guess you're still in the same folder when you run the love?
Post Reply

Who is online

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