def copy_template_resource(self, dest_path, resource_name):
plugin_dir_name = os.path.basename(os.path.dirname(os.path.realpath(__file__)))
# extract plugin name from file with extention ".sublime-package":
# Electric Imp Developer.sublime-package
plugin_name, ext = os.path.splitext(plugin_dir_name)
# see https://www.sublimetext.com/docs/3/api_reference.html:
# load_resource(name) - Loads the given resource.
# The name should be in the format Packages/Default/Main.sublime-menu.
resource_path = '/'.join(["Packages", plugin_name, PR_TEMPLATE_DIR_NAME, resource_name])
content = sublime.load_resource(resource_path)
dest_path = os.path.join(dest_path, resource_name) if os.path.isdir(dest_path) else dest_path
with open(dest_path, 'a', encoding="utf-8") as f:
f.write(content)
评论列表
文章目录