[英]Create Sublime Text build system for build and source in different directories
I have a project for which the build and source directories are not the same. 我有一个项目,其生成目录和源目录不相同。 I'd like to create a build system that will build in the build
directory while I am editing in the source
directory. 我想创建一个在source
目录中编辑时将在build
目录中构建的构建系统 。
Let's say I have this directory structure: 假设我有以下目录结构:
(shocking and unique naming system, I know - let's hold the applause until the end, shall we?) (我知道令人震惊且独特的命名系统-让我们鼓掌掌声,好吗?)
The build is nested many layers deep, and the directory structures are symmetric. 该构建嵌套在很深的多层中,并且目录结构是对称的。 From a directory in the source
, I would like Sublime to start a build in the related build
directory. 从source
目录中,我希望Sublime在相关的build
目录中开始build
。 For instance, if I am editing /home/dbw/src/foo/Makefile, I'd like make to execute in /home/dbw/bld/foo. 例如,如果我正在编辑/ home / dbw / src / foo / Makefile,我想使make在/ home / dbw / bld / foo中执行。 I've tried this: 我已经试过了:
{
"cmd": ["make"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "/home/dbw/bld/${file_path/$project_path//}",
"selector": "source.makefile",
"variants":
[
{
"name": "Clean",
"cmd": ["make", "clean"]
},
{
"name": "Test",
"cmd": ["make", "test"]
}
]
}
My .sublime-project is in /home/dbw/src 我的.sublime-project位于/ home / dbw / src中
I also tried using "working_dir": "/home/dbw/bld/${file_path/\\/home\\/dbw\\/src//}"
. 我也尝试使用"working_dir": "/home/dbw/bld/${file_path/\\/home\\/dbw\\/src//}"
。
It looks to me like the problem is that I am not escaping slashes in the replacement expression correctly. 在我看来,问题在于我没有正确地在替换表达式中转义斜线。 Any suggestions? 有什么建议么?
I did this, and it works. 我做到了,而且有效。
"working_dir": "/home/dbw/bld${file_path/.home.dbw.src//}"
It still seems a bit inelegant to me, though. 不过,对我来说,这似乎仍然有些微不足道。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.