forked from shagabutdinov/sublime-open-path
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenPath.py
More file actions
30 lines (25 loc) · 973 Bytes
/
OpenPath.py
File metadata and controls
30 lines (25 loc) · 973 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import sublime, sublime_plugin, os
from subprocess import call
def open_path(folder, where) :
settings = sublime.load_settings("OpenPath.sublime-settings")
if where == "file_manager" :
command = settings.get("file_manager", "explorer /e /root,\"{0}\"")
else :
command = settings.get("terminal", "notify-send \"Open Path\" \"{0}\"")
command = command.format(folder)
call(command, shell=True)
class OpenPath(sublime_plugin.WindowCommand):
def run(self, path):
open_path(path)
class OpenFolder(sublime_plugin.WindowCommand):
def run(self, **args):
path = None
if args["folder"] == "project" :
if len(self.window.folders()) == 0:
return
path = self.window.folders()[0]
else :
if self.window.active_view() is None:
return
path = os.path.dirname(self.window.active_view().file_name())
open_path(path, args["where"])