Python sublime.executable_path() Examples

The following are 7 code examples of sublime.executable_path(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module sublime , or try the search function .
Example #1
Source File: project_manager.py    From ProjectManager with MIT License 6 votes vote down vote up
def subl(*args):
    executable_path = sublime.executable_path()
    if sublime.platform() == 'osx':
        app_path = executable_path[:executable_path.rfind('.app/') + 5]
        executable_path = app_path + 'Contents/SharedSupport/bin/subl'

    subprocess.Popen([executable_path] + list(args))

    def on_activated():
        window = sublime.active_window()
        view = window.active_view()

        if sublime.platform() == 'windows':
            # fix focus on windows
            window.run_command('focus_neighboring_group')
            window.focus_view(view)

        sublime_plugin.on_activated(view.id())
        sublime.set_timeout_async(lambda: sublime_plugin.on_activated_async(view.id()))

    sublime.set_timeout(on_activated, 300) 
Example #2
Source File: util.py    From JavaScriptEnhancements with MIT License 6 votes vote down vote up
def subl(args):
  
  executable_path = sublime_executable_path()
  args = [executable_path] + args
  args_list = list()

  if sublime.platform() == 'windows' :
    for arg in args :
      args_list.append(json.dumps(arg, ensure_ascii=False))
  else :
    for arg in args :
      args_list.append(shlex.quote(arg))
  
  args = " ".join(args_list)

  return subprocess.Popen(args, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 
Example #3
Source File: dired_misc.py    From SublimeFileBrowser with MIT License 5 votes vote down vote up
def launch_ST3(self, files):
        executable_path = sublime.executable_path()
        if OSX:
            app_path = executable_path[:executable_path.rfind(".app/")+5]
            executable_path = app_path+"Contents/SharedSupport/bin/subl"
        items = [executable_path, "-n"] + files
        subprocess.Popen(items, cwd=None if NT else self.path) 
Example #4
Source File: uiutil.py    From SalesforceXyTools with Apache License 2.0 5 votes vote down vote up
def open_project(self, open_path):
        executable_path = sublime.executable_path()
        if sublime.platform() == 'osx':
            app_path = executable_path[:executable_path.rfind(".app/") + 5]
            executable_path = app_path + "Contents/SharedSupport/bin/subl"

        if sublime.platform() == "windows":
            subprocess.Popen('"{0}" --project "{1}"'.format(executable_path, open_path), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
        else:
            process = subprocess.Popen([executable_path, '--project', open_path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
            stdout, stderr = process.communicate()
            self.debug(stdout)
            self.showlog(stderr) 
Example #5
Source File: Localize.py    From LocalizedMenu with MIT License 5 votes vote down vote up
def init():
	absDir = os.path.dirname(os.path.abspath(__file__))
	if v == '3' and os.path.isfile(absDir):
		pkgDir = os.path.join(sublime.packages_path(), pName);
		if not os.path.isdir(pkgDir):
			unpackSelf(absDir, pkgDir)
		return
	locale = ''
	firstRun = False
	fFile = os.path.join(pDir, '.firstRun')
	if not os.path.isfile(fFile):
		firstRun = True
		backupMenu()
		open(fFile, 'wt').write('')
		locale = getSetting('locale', '')
	eDir = os.path.join(mDir, version, 'en');
	if v == '3' and not os.path.isdir(eDir):
		eFile = sublime.executable_path();
		dFile = os.path.join(os.path.dirname(eFile), 'Packages', 'Default.sublime-package');
		unpackMenu(dFile, eDir);
	makeMenu(locale, firstRun)
	makeCommand(locale, firstRun)
	setLocale(locale, firstRun)

	s = sublime.load_settings(sFile)
	s.add_on_change('locale', updateLocale) 
Example #6
Source File: util.py    From JavaScriptEnhancements with MIT License 5 votes vote down vote up
def sublime_executable_path():
  executable_path = sublime.executable_path()

  if sublime.platform() == 'osx':
    app_path = executable_path[:executable_path.rfind(".app/") + 5]
    executable_path = app_path + "Contents/SharedSupport/bin/subl"

  elif sublime.platform() == 'windows':
    executable_path = os.path.join(os.path.dirname(executable_path), "subl.exe")

  return executable_path 
Example #7
Source File: Localization.py    From Chinese-Localization with MIT License 5 votes vote down vote up
def get_builtin_pkg_path():
    base_path = os.path.dirname(sublime.executable_path())
    ret = os.path.join(base_path, 'Packages')
    return ret