I know that we can remove a folder from a project using:
window.run_command('remove_folder', {'dirs': '/path/folder_name']})
So, how to add a folder to a project?
I know that we can remove a folder from a project using:
window.run_command('remove_folder', {'dirs': '/path/folder_name']})
So, how to add a folder to a project?
Hi,
The plugin SideBarEnhancements includes functionality like this. It involves reading and writing the project json files. You might want to take a look at these files
For ST2: https://github.com/titoBouzout/SideBarEnhancements/blob/master/sidebar/SideBarProject.py
For ST3: https://github.com/titoBouzout/SideBarEnhancements/blob/st3/sidebar/SideBarProject.py
It looks like it’s a lot easier in ST3.
Alternatively, you can go ST3 only and use the window.project_data() and window.set_project_data() api. An example from the Sublime Text 3 console:
>>> d = window.project_data()
>>> print(d)
{'folders': {'path': 'project1'}]}
>>> d'folders'].append({'path': 'project2'})
>>> d
{'folders': {'path': 'project1'}, {'path': 'project2'}]}
>>> window.set_project_data(d)
Yeah, thank you ,I got it…
see my plugin https://github.com/hellojinjie/OpenCurrentFolder