wbond / package_control

The Sublime Text package manager
https://packagecontrol.io
4.79k stars 815 forks source link

Fix path detection algorithm #1681

Closed deathaxe closed 4 months ago

deathaxe commented 4 months ago

Fix path detection algorithm

This commit uses a more robust algorithm to determine ST paths at startup, which no longer relies on Default.sort module.

It fixes an issue, which caused {st_dir}/Packages path detection to fail, if Default package is extracted to {data}/Packages by end users.

To determine default package path, it first tries sublime.executable_path(), which returns valid paths at import time on ST4088+ or with mocked ST API in CI environments. When running on ST3, abspath(sys.executable) is used instead to return plugin_host's absolute path. Without it, sys.executable only returns "python" on ST3's plugin_host.