wbond / package_control

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

Moving cache to LOCALAPPDATA causes exception #1488

Closed deathaxe closed 4 years ago

deathaxe commented 4 years ago

As of commit f305a338a71e5574f2bd41fab5f0c0065a7126ac Package Control raises an exception with expected cache paths not to exist.

Traceback (most recent call last):
  File "C:\Apps\Sublime Text\Lib\python33\sublime_plugin.py", line 400, in load_module
    m.plugin_loaded()
  File "C:\Apps\Sublime Text\Data\Packages\Package Control\Package Control.py", line 139, in plugin_loaded
    os.mkdir(sys_path.pc_cache_dir)
FileNotFoundError: [WinError 3] Das System kann den angegebenen Pfad nicht finden: 'C:\\Users\\DeathAxe\\AppData\\Local\\Data\\Cache\\Package Control'

The reason are the following lines:

https://github.com/wbond/package_control/blob/3cd5839c20b24efe8bf1bc50bb5e4af5f837ba38/package_control/sys_path.py#L90-L98

Please rely on sublime.cache_path() if available.

ST portable should propably not use %LOCALAPPDATA% or any other path outside of <install_dir>/data/.

I don't use %APPDATA% to store ST / SM data at all, so it seems weird to have the new cache paths anywhere there.

wbond commented 4 years ago

Thanks for reporting this! I don’t use sublime.cache_path() most due to historical reasons of paths being used before the plugin is loaded. Based on your bug report I’ll work on refactoring it.

wbond commented 4 years ago

67ef2e02fef941c01694a52c5dfc3a08f86fbe49 should hopefully fix this.