how to get the folder path of the opened files in sidebar folder?
Project folder path
hi Tito. it works but how can I get the folder of the currently edited file? Thank you
[quote=“cargie”]
hi Tito. it works but how can I get the folder of the currently edited file? Thank you[/quote]
You can get the full file path so:curr_full_path = sublime.active_window().active_view().file_name()
And with the following function you gets an dictionary with all parts of the path:[code]import os.path
returns dictionary of currently active file, splitted by all path parts
def get_curr_file(full=None):
curr_full_path = sublime.active_window().active_view().file_name()
if full:
return curr_full_path
split = os.path.split(curr_full_path)
dirname = split[0]
basename = split[1]
split = os.path.splitdrive(curr_full_path)
drive = split[0]
split = os.path.splitext(curr_full_path)
ext = split[1]
return {“drive”: drive, “dirname”: dirname, “basename”: basename, “ext”: ext}[/code]