Skip to content

Commit

Permalink
Use os.path.relpath on a normalized Packages base path
Browse files Browse the repository at this point in the history
The previous method fails because it assumes `packages_path` is
normalized, yet it will not be when Sublime Text is started via the `subl`
command with a non-normalized `PATH` entry
(i.e. `PATH=z:\bin\..\tools\sublime_text`)
  • Loading branch information
adill committed Nov 11, 2019
1 parent 8bfce29 commit f14209a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion typescript/libs/popup_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def load_html_template(html_file_name):
html_path = os.path.join(PLUGIN_DIR, html_file_name)

# Needs to be in format such as: 'Packages/TypeScript/signature_popup.html'
rel_path = html_path[len(sublime.packages_path()) - len('Packages'):]
rel_path = os.path.relpath(html_path, os.path.normpath(os.path.join(sublime.packages_path(), '..')))
rel_path = rel_path.replace('\\', '/') # Yes, even on Windows

log.info('Loaded html template from {0}'.format(rel_path))
Expand Down

0 comments on commit f14209a

Please sign in to comment.