Skip to content

Conversation

@Kashin-J
Copy link

@Kashin-J Kashin-J commented Dec 2, 2016

- According to the document specification of Sublime Text(see: http://docs.sublimetext.info/en/sublime-text-3/basic_concepts.html#the-user-package),
custom data for the user's plug-in should be stored in the
`Packages/User` folder.
- `Packages/User` folder data can be used for synchronization between
 multiple machines.(see: https://packagecontrol.io/docs/syncing)
- So I created the `FileHeader-template/header` and `FileHeader-template/body`
 folders in the `Packages/User` directory, which are used as the default directory for the template files.
@shiyanhui
Copy link
Owner

shiyanhui commented Dec 3, 2016

Hi,

I'm wondering that have you tested it? Actually it doesn't work since FileHeader-template/header and FileHeader-template/body will cover builtin templates if custom_template_ path is not set. There is nothing in FileHeader-template/header and FileHeader-template/body in default.

@Kashin-J
Copy link
Author

Kashin-J commented Dec 3, 2016

I'm sure I've tested it, and it works fine.You may need to carefully review the code.
If "custom_template_path" is not set, it will take the "FileHeader-template / ***" configuration, and if "FileHeader-template / " is not set, it will take the builtin configuration. In other words, the priority is this: "custom_template__path">"FileHeader-template / ***">"builtin".

BODY_PATH = os.path.join(PLUGIN_PATH, 'template/body')
INSTALLED_PLGIN_PATH = os.path.abspath(os.path.dirname(__file__))
DEFAULT_CUSTOM_TEMPLATE_HEADER_PATH = os.path.join(PACKAGES_PATH, 'User/FileHeader-template/header')
DEFAULT_CUSTOM_TEMPLATE_BODY_PATH = os.path.join(PACKAGES_PATH, 'User/FileHeader-template/body')
Copy link
Owner

@shiyanhui shiyanhui Dec 4, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change it to below may be better:

DEFAULT_CUSTOM_TEMPLATE_PATH = os.path.join(PACKAGES_PATH, 'User/FileHeader-template') DEFAULT_CUSTOM_TEMPLATE_HEADER_PATH = os.path.join(DEFAULT_CUSTOM_TEMPLATE_PATH, 'header') DEFAULT_CUSTOM_TEMPLATE_BODY_PATH = os.path.join(DEFAULT_CUSTOM_TEMPLATE_PATH, 'body')

@shiyanhui
Copy link
Owner

Yeah, you are right, sorry. I write some review to make the code more clean. After you modified it, I'll merge it. Thanks:)

@Kashin-J
Copy link
Author

Kashin-J commented Dec 4, 2016

Thank you for your revision.
This is the first time I use Python coding, do not understand some of its norms, please forgive me.
Oh, by the way, I suggest you update the FAQ in the README.Thinks:)

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

Successfully merging this pull request may close these issues.

2 participants