+2
posted by Robertcollier4, 2 years ago , 0

Many Windows users have Explorer replacements such as Total Commander, XYPlorer, Directory Opus, xplorer2, etc. These usually replace explorer.exe via changing the Folder handler in the registry at: [HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\]


However - even when someone has a custom folder handler setup - SublimeText currently always opens a folder via Explorer.exe and not through an os-specific way. An alternative to fix this that I have tested is to use os.startfile("C:\folderpath"). For example the following will respect the user's custom directory handler:


import sublime, sublime_plugin, os


class OpenContainingDirCommand(sublime_plugin.TextCommand):

    def run(self, edit):

        branch, leaf = os.path.split(self.view.file_name())

        os.startfile(branch)


So please use os.startfile(dirpath) for things such as "Browse Package".

Vote