Sublime Forum

Get selected folder from sidebar

#1

Hi Everyone,
i’m looking for method to get the path from folder that exist in the sidebar.
so far, i founded this way: class AddConfigCommand(sublime_plugin.WindowCommand): def run(self, files): if not files: files.append(sublime.active_window().active_view().file_name()) which return me the path only if it a file, but if it a folder it return me Null.
the files parameter came from Side Bar.sublime-menu file: { "caption": "Create New Config", "command": "add_config", "args": { "files": ] }

Another option that maybe can help in some way is to get the “where” line from the function ‘Find in folder’ which return the path of file/folder.

0 Likes