def open(self, use_powershell = True):
if self.isDirectory():
import subprocess
if sublime.platform() == 'osx':
subprocess.Popen(['/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal', '.'], cwd=self.forCwdSystemPath())
elif sublime.platform() == 'windows':
if use_powershell:
try:
subprocess.Popen(['start', 'powershell'], cwd=self.forCwdSystemPath(), shell=True)
except:
subprocess.Popen(['start', 'cmd', '.'], cwd=self.forCwdSystemPath(), shell=True)
else:
subprocess.Popen(['start', 'cmd', '.'], cwd=self.forCwdSystemPath(), shell=True)
elif sublime.platform() == 'linux':
subprocess.Popen(['gnome-terminal', '.'], cwd=self.forCwdSystemPath())
else:
if sublime.platform() == 'osx':
import subprocess
subprocess.Popen(['open', self.name()], cwd=self.dirname())
elif sublime.platform() == 'windows':
import subprocess
subprocess.Popen(['start', '', escapeCMDWindows(self.path())], cwd=self.dirname(), shell=True)
else:
from . import desktop
desktop.open(self.path())
print('using desktop')
评论列表
文章目录