Home Download Buy Blog Forum Support

Getting working directory for a project

Getting working directory for a project

Postby Adagioklez on Mon Feb 28, 2011 8:02 pm

Hello I'm currently experimenting with getting my SBT (Simple build tool) project to interact with ST2.
However when I have defined a build like:
{
"cmd": ["sbt.bat", "$working_dir"],
"working_dir": "${project_path:${folder}}",
"selector": "source.java, source.scala"
}
The working_dir just result in "".
I'm not sure how to retrieve properties from my project, of if there is somewhere to look.
I have also tried to set: "working_dir": "D:\sbtlift", but that also result in "" in the console.

Any help is appreciated:)

Regards Stefan
Adagioklez
 
Posts: 15
Joined: Fri Feb 25, 2011 1:03 pm

Re: Getting working directory for a project

Postby jps on Tue Mar 01, 2011 12:50 am

If you're setting the working directory to an explicit path, make sure you escape the backslashes.

For the Make.sublime-build, I'm now using a working dir of:

Code: Select all
"working_dir": "${project_path:${folder:${file_path}}}"


This will use these directories, in order of preference:

- The directory the project is in, if a project is opened
- The the first folder on the side bar, if there are any
- The directory of the current file
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm

Re: Getting working directory for a project

Postby Adagioklez on Tue Mar 01, 2011 7:29 am

Hello jps,

Thanks for your time.
I unfortunately still doesn't work. I get the following output:
Output:
C:\Users\Stefan\Desktop>set SCRIPT_DIR=D:\sbt\

C:\Users\Stefan\Desktop>java -Xmx512M -noverify
-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=512m -Djline.WindowsTerminal.directConsole=false -jar "D:\sbt\sbt-launch-0.7.4.jar" ""
Project does not exist, create new project? (y/N/s)
[Finished]

Where the "" corresponding to the working dir.
My build configuration is the following:
{
"cmd": ["sbt.bat", "$working_dir"],
"working_dir": "${project_path:${folder:${file_path}}}",
"selector": "source.java, source.scala"
}

I have tried to save to project again, and opened it, but it still only gives me the empty string. Do you have any other ideas?

Regards Stefan
Adagioklez
 
Posts: 15
Joined: Fri Feb 25, 2011 1:03 pm

Re: Getting working directory for a project

Postby jps on Tue Mar 01, 2011 9:48 am

Sorry, I missed what you're trying to do.

working_dir can't be used as a variable in the command like that, it just sets up the initial working directory where the command is run from.

It looks like you want something like:

Code: Select all
{
    "cmd": ["sbt.bat", "${project_path:${folder:${file_path}}}"],
    "selector": "source.java, source.scala"
}
jps
Site Admin
 
Posts: 3067
Joined: Wed Mar 19, 2008 12:33 pm


Return to Technical Support

Who is online

Users browsing this forum: Yahoo [Bot] and 18 guests