I’m trying to get a .sublime-build file that works for scons in a generic fashion for c/cpp files that aren’t associated with Sublime projects. It seems like Sublime doesn’t support this scenario, but what here’s what I’ve tried in my .sublime-build file so far:
{
"cmd": "scons"],
"file_regex": "^(..^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"selector": "source.c, source.c++",
}
…which works to call the build system fine. However, I have source organized like so:
root/dira/SConstruct
root/dira/foo/foo.c
root/dirb/SConstruct
root/dirb/bar/bar.c
When building foo.c, scons prints file paths as relative to the SConstruct file. So in this case, I have foo.c open, hit ctrl-B, and my errors look something like:
scons: Entering directory `/root/dira'
scons: Reading SConscript files ...
Read: /root/dira/SConstruct
scons: done reading SConscript files.
Compiling foo/foo.c ...
foo/foo.c:42: error: 'publ' does not name a type
Hitting F4 from here opens a new empty buffer called “foo/foo.c”. I don’t know what to put in my .sublime-build file’s “working_dir” setting to specify that the captured filename is relative to something that isn’t really anything that’s listed in the build system variables.
I was hoping the .sublime-build “keyfiles” setting would help, but I’m not sure how to make use of that. It’s almost like I want to be able to write the moral equivalent of the following:
"keyfiles": "SConstruct"],
"working_dir": "${keyfile}",
Any suggestions on how to get this to work?
Thanks,
John