From f14209a5bda8110aa9f8734dbb34854a60b92dc2 Mon Sep 17 00:00:00 2001 From: Andy Dill Date: Mon, 11 Nov 2019 11:15:54 -0800 Subject: [PATCH] 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`) --- typescript/libs/popup_manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/typescript/libs/popup_manager.py b/typescript/libs/popup_manager.py index b0e7d422..46575687 100644 --- a/typescript/libs/popup_manager.py +++ b/typescript/libs/popup_manager.py @@ -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))