You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

25 lines
805 B

import subprocess
from binaryornot.check import is_binary
import os
EDITOR_PATH =
def edit(path,params=[]):
call_chain = [EDITOR_PATH] + params
if not is_binary(path):
call_chain.append(path)
subprocess.call(call_chain)
def standalone(path,params=[],windowless =False,cwd = None):
path2windowless = os.path.join(os.path.dirname(__file__),'windowless.vbs')
params = list(map(os.path.expandvars,params))
if not cwd:
cwd = os.path.dirname(path)
else:
cwd = os.path.expandvars(cwd)
if windowless:
cmd = ' '.join('~{}~'.format(arg) if ' ' in arg else arg for arg in [fullpath]+params)
print(cmd)
subprocess.check_output(["cscript.exe",path2windowless,cmd,cwd])
else:
subprocess.Popen([fullpath]+params,cwd=cwd)