forked from fjl/Sublime-Erlang
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.py
More file actions
20 lines (17 loc) · 693 Bytes
/
Copy pathplugin.py
File metadata and controls
20 lines (17 loc) · 693 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import sublime, sublime_plugin
if (sublime.version() != '') and (sublime.version() < '3000'):
pass
else:
from .st3 import ErlangCommandHooks
class ExecInProjectFolderCommand(sublime_plugin.WindowCommand):
def run(self, **kwargs):
folders = self.window.folders()
if len(folders) >= 1:
kwargs['working_dir'] = folders[0]
v = self.window.active_view()
if v is not None and v.file_name() is not None:
for folder in folders:
if v.file_name().startswith(folder):
kwargs['working_dir'] = folder
break
self.window.run_command("exec", kwargs)