SideBarAPI.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:.sublime 作者: cxdongjack 项目源码 文件源码
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')
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号