Sublime Forum

Creating a build process and using PATH

#1

This is my build system for the monkey programming language

[code]{
“cmd”: “trans_macos”, “-config=debug -target=html5”, “”$file""],
“working_dir”: “${project_path:${folder:${file_path}}}”,
“selector”: “source.monkey”,

"windows":
{
	"cmd": "trans_winnt.exe"]
}

}[/code]
As far as i can see this is OK, but I get the following error message:

[Errno 2] No such file or directory

The file path is valid and the command runs OK from the command line, though I’m unable to reproduce the error from the command line.

In the docs it says that the command used needs to be in the PATH (it is) but that the PATH used may vary from the default shell one (how?).

So, how do I add to the PATH used by Sublime Text 2?

Any advice appreciated.

Thanks,
matt

0 Likes

#2

I can get things working if I specify the full path to the cmd.

So, any idea how I can add to PATH and have Sublime Text find it?

0 Likes

#3

See the “env” option, it might do want you need:

sublimetext.info/docs/reference/ … stems.html

0 Likes

#4

I cannot get “env” working at all.

Adding it prevents the build system from working.

0 Likes

#5

Can you show what you’ve got in your build system?

0 Likes

#6

This is my current build system:

{ "cmd": "/Applications/monkey/bin/trans_macos", "-target=html5", "-run", "\"$file\""], "working_dir": "${project_path:${folder:${file_path}}}", "selector": "source.monkey" }

0 Likes

#7

I don’t see the “env:” part :smile:

0 Likes

#8

I don’t know how to get that working at all. I added it in and Sublime didn’t do the build at all.

Can you post a working example?

I am currently doing this workaround: OSX Path problem - can't use Make

0 Likes

#9

Yeah, there seems to be something wrong with build systems.

On Windows, Popen receives a unicode object instead of a bytestring for the env parameter and throws an error. If you modify exec to encode the unicode object, the value is accepted. Also, exec replaces the current process’ environment variables with what it is passed in the the build system, so PATH will be overwritten. I’ve tried modifying exec to expand environment variables in the “env” parameter, but it seems that appended paths to PATH still don’t work as expected: I always get a file not found error, although PATH seems to be right. Absolute paths work fine.

0 Likes