Home Download Buy Blog Forum Support

Creating a build process and using PATH

Creating a build process and using PATH

Postby gingerbeardman on Fri Apr 15, 2011 11:37 am

This is my build system for the monkey programming language
Code: Select all
{
   "cmd": ["trans_macos", "-config=debug -target=html5", "\"$file\""],
   "working_dir": "${project_path:${folder:${file_path}}}",
   "selector": "source.monkey",

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

As far as i can see this is OK, but I get the following error message:
Code: Select all
[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
gingerbeardman
 
Posts: 10
Joined: Fri Apr 15, 2011 11:33 am

Re: Creating a build process and using PATH

Postby gingerbeardman on Mon Apr 18, 2011 11:52 am

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?
gingerbeardman
 
Posts: 10
Joined: Fri Apr 15, 2011 11:33 am

Re: Creating a build process and using PATH

Postby guillermooo on Mon Apr 18, 2011 12:34 pm

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

http://sublimetext.info/docs/reference/ ... stems.html
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am

Re: Creating a build process and using PATH

Postby gingerbeardman on Mon Apr 18, 2011 2:20 pm

I cannot get "env" working at all.

Adding it prevents the build system from working.
gingerbeardman
 
Posts: 10
Joined: Fri Apr 15, 2011 11:33 am

Re: Creating a build process and using PATH

Postby guillermooo on Mon Apr 18, 2011 2:42 pm

Can you show what you've got in your build system?
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am

Re: Creating a build process and using PATH

Postby gingerbeardman on Tue Apr 19, 2011 3:21 pm

This is my current build system:
Code: Select all
{
   "cmd": ["/Applications/monkey/bin/trans_macos", "-target=html5", "-run", "\"$file\""],
   "working_dir": "${project_path:${folder:${file_path}}}",
   "selector": "source.monkey"
}
gingerbeardman
 
Posts: 10
Joined: Fri Apr 15, 2011 11:33 am

Re: Creating a build process and using PATH

Postby guillermooo on Tue Apr 19, 2011 3:31 pm

I don't see the "env:" part :)
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am

Re: Creating a build process and using PATH

Postby gingerbeardman on Wed Apr 20, 2011 10:18 am

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: viewtopic.php?f=3&t=1716
gingerbeardman
 
Posts: 10
Joined: Fri Apr 15, 2011 11:33 am

Re: Creating a build process and using PATH

Postby guillermooo on Wed Apr 20, 2011 10:10 pm

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.
guillermooo
 
Posts: 728
Joined: Thu Jul 23, 2009 9:06 am


Return to Technical Support

Who is online

Users browsing this forum: Exabot [Bot], Yahoo [Bot] and 25 guests