def communicate(self, cmd, code=None):
"""Run an external executable using stdin to pass code and return its output."""
if '__RELATIVE_TO_FOLDER__' in cmd:
relfilename = self.filename
window = self.view.window()
# can't get active folder, it will work only if there is one folder in project
if int(sublime.version()) >= 3080 and len(window.folders()) < 2:
vars = window.extract_variables()
if 'folder' in vars:
relfilename = os.path.relpath(self.filename, vars['folder'])
cmd[cmd.index('__RELATIVE_TO_FOLDER__')] = relfilename
elif not code:
cmd.append(self.filename)
return super().communicate(cmd, code)
评论列表
文章目录