Skip to content

Commit f14209a

Browse files
committed
Use os.path.relpath on a normalized Packages base path
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`)
1 parent 8bfce29 commit f14209a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

typescript/libs/popup_manager.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ def load_html_template(html_file_name):
286286
html_path = os.path.join(PLUGIN_DIR, html_file_name)
287287

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

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

0 commit comments

Comments
 (0)