Running love2d from sublime when not in root folder

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.
Post Reply
zell2002
Citizen
Posts: 75
Joined: Sun Feb 23, 2014 9:22 pm

Running love2d from sublime when not in root folder

Post by zell2002 »

i have this for my build :

Code: Select all

{
    "selector": "source.lua",
    "cmd": ["H:/LOVE/love.exe", "$file_path"],
    "shell": true
}
say im working on a project MyGame
H:\LOVE\MyGame\

and in that I have main.lua and another folder "Library" which has a helper.lua file
H:\LOVE\MyGame\Library\helper.lua file

when in Sublime Text 2, if im working inside MyGame folder, ie on main.lua i can hit ctrl+b and my build package runs fine. but if im working inside any sub folder i get the "boot.lua:364: No code to run"

Is there a way to get it so it doesn't matter folder I'm in for a build/run ?
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: Running love2d from sublime when not in root folder

Post by Azhukar »

You can make a batchfile/script to run your project and always call the batchfile in your text editor.
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Running love2d from sublime when not in root folder

Post by s-ol »

zell2002 wrote:i have this for my build :

Code: Select all

{
    "selector": "source.lua",
    "cmd": ["H:/LOVE/love.exe", "$file_path"],
    "shell": true
}
say im working on a project MyGame
H:\LOVE\MyGame\

and in that I have main.lua and another folder "Library" which has a helper.lua file
H:\LOVE\MyGame\Library\helper.lua file

when in Sublime Text 2, if im working inside MyGame folder, ie on main.lua i can hit ctrl+b and my build package runs fine. but if im working inside any sub folder i get the "boot.lua:364: No code to run"

Is there a way to get it so it doesn't matter folder I'm in for a build/run ?
Change $file_path to $project_path. Then you won't be able to launch single files any more (it they are not you current folder's), but you can fix it with:
${project_path:$file_path} iirc, check it on the ST2 wiki page.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
zell2002
Citizen
Posts: 75
Joined: Sun Feb 23, 2014 9:22 pm

Re: Running love2d from sublime when not in root folder

Post by zell2002 »

using "${project_path:$file_path}" has the same results im afraid

im not 100% sure how I would write the batch file to do it for me inside sublime ...
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: Running love2d from sublime when not in root folder

Post by Azhukar »

zell2002 wrote:using "${project_path:$file_path}" has the same results im afraid

im not 100% sure how I would write the batch file to do it for me inside sublime ...
Make a script (depending on what os you're on) that runs your folder with love. In your texteditor then always start the script when you wish to run the project.

For example I have this .bat file in the same folder as my main.lua and love:

Code: Select all

start "" "%~dp0love/32/love.exe" "%cd%"
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Running love2d from sublime when not in root folder

Post by s-ol »

zell2002 wrote:using "${project_path:$file_path}" has the same results im afraid

im not 100% sure how I would write the batch file to do it for me inside sublime ...
Then you aren't in "project mode" in sublime (or w/e you eant to call it), create a new project with the folder containing main.lua as the root folder.

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
zell2002
Citizen
Posts: 75
Joined: Sun Feb 23, 2014 9:22 pm

Re: Running love2d from sublime when not in root folder

Post by zell2002 »

aahhh!!!
cheers !

I wasn't aware sublime specific project settings - cool :)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 193 guests