Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions DKit.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
def get_shell_args(args):
return ' '.join(args)

def get_dub_path():
global plugin_settings
plugin_settings = sublime.load_settings('DKit.sublime-settings')

dub_path = read_settings('dub_path', '')
dub_exe = os.path.join(dub_path, 'dub' + ('.exe' if sys.platform == 'win32' else ''))
return dub_exe


def read_settings(key, default):
global plugin_settings
if plugin_settings is None:
Expand Down Expand Up @@ -159,7 +168,7 @@ def start_server():
return True

def update_project(view, package_file):
dub = Popen(get_shell_args(['dub', 'describe']), stdin=PIPE, stdout=PIPE, shell=True, cwd=os.path.dirname(package_file))
dub = Popen(get_shell_args([get_dub_path(), 'describe']), stdin=PIPE, stdout=PIPE, shell=True, cwd=os.path.dirname(package_file))
description = dub.communicate()
description = description[0].decode('utf-8')

Expand Down Expand Up @@ -410,7 +419,7 @@ def _process_escape_codes(self, match):
class DubListInstalledCommand(sublime_plugin.TextCommand):
def run(self, edit):
try:
dub = Popen(get_shell_args(['dub', 'list']), stdin=PIPE, stdout=PIPE, shell=True)
dub = Popen(get_shell_args([get_dub_path(), 'list']), stdin=PIPE, stdout=PIPE, shell=True)
output = dub.communicate()
output = output[0].splitlines()
del output[0]
Expand Down
2 changes: 2 additions & 0 deletions DKit.sublime-settings
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
// Path to the directory containing both dcd-client and dcd-server executables
"dcd_path": "/setup/my/path",
// Path to the directory containing the dub executable (leave empty to use DUB from the $PATH)
"dub_path": "",
// Port to use for DCD client and server
"dcd_port": 9166,
// Include path for existing source files.
Expand Down