【发布时间】:2020-02-03 15:16:05
【问题描述】:
我需要运行不同的编译器,具体取决于正在编辑的文件将用于哪个版本的应用程序。
源文件始终存储在包含版本号的路径中。
so 文件
%APPDATA%\App\9\Settings\Source.file
需要运行
%ProgramFiles%\App\9\Compiler.exe "%APPDATA%\App\9\Settings\Source.file"
和%APPDATA%\App\11\Settings\Source.file
需要运行
%ProgramFiles%\App\11\Compiler.exe "%APPDATA%\App\11\Settings\Source.file"
我已尝试按照此处的高级示例进行操作: https://www.sublimetext.com/docs/3/build_systems.html#advanced_example
但是 python 真的不是我的东西,我似乎无法运行任何东西
基本有效,但我无法指定版本:
{
"cmd": ["c:\\Program Files\\App\\10\\compile.exe", "$file"],
"selector": "source.app",
"file_patterns": "*.ext"
}
但这不是:
{
"target": "app_build",
"selector": "source.app",
"file_patterns": "*.ext"
}
.py 文件
import sublime
import sublime_plugin
class AppBuildCommand(sublime_plugin.WindowCommand):
def run (self):
vars = self.window.extract_variables()
compiler = vars['file_path']
compiler = compiler.split("\\")
compiler_path = "c:\\Program Files\\App\\" + compiler[compiler.index("App")+1] + "\\Compiler.exe"
file = vars['file']
self.window.run_command (compiler + " \"" + file + "\"")
也试过没有成功:
args = []
args.append(compiler)
args.append(file)
self.window.run_command("cmd", args)
【问题讨论】:
标签: python sublimetext3 build-system