Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

passing current project path #58

Open
yangkennyk opened this issue May 16, 2019 · 1 comment
Open

passing current project path #58

yangkennyk opened this issue May 16, 2019 · 1 comment

Comments

@yangkennyk
Copy link

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
Copy link
Author

yangkennyk commented May 17, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant