ProjectMaker icon indicating copy to clipboard operation
ProjectMaker copied to clipboard

passing current project path

Open yangkennyk opened this issue 6 years ago • 1 comments

I'm trying to use this plugin as a way to create different "projects" within a project.

I just need to folder/file templating structure to create different folder blocks but I can't find a way to pass the current opened project path into the default_project_path argument.

how can I do that?

yangkennyk avatar May 16 '19 15:05 yangkennyk

ok for anyone else looking to try to do this. spent an afternoon trying to understand how sublime plugins work, dissecting a bunch of other plugins, a lot of trial and error.

for the default_project_path_setting = settings.get('default_project_path') line in projectmaker.py

change it to

window = sublime.active_window()
project_folders = window.folders()
project_data = window.project_data()
if project_data is not None:
        default_project_path_setting = project_data["folders"][0]["path"]
else:
        default_project_path_setting = settings.get('default_project_path')

and it'll pull the path of the first folder in your project window as the path of the new project template you are creating.

on a side note. how can I debug these plugins in a better way? I was basically just randomly trying variables, trying to run the plugin, if it broke/didn't work I would try another variable until something worked.

yangkennyk avatar May 17 '19 15:05 yangkennyk