diff --git a/jedi/settings.py b/jedi/settings.py index 3515f277..1b9125b6 100644 --- a/jedi/settings.py +++ b/jedi/settings.py @@ -81,6 +81,8 @@ Various """ +import os +import platform # ---------------- # completion output settings @@ -119,10 +121,18 @@ use_filesystem_cache = True Use filesystem cache to save once parsed files with pickle. """ -import os -cache_directory = os.getenv('HOME') + os.path.sep + '.jedi' +if platform.system().lower() == 'windows': + _cache_directory = os.path.join(os.getenv('APPDATA') or '~', 'Jedi', 'Jedi') +elif platform.system().lower() == 'darwin': + _cache_directory = os.path.join('~', 'Library', 'Caches', 'Jedi') +else: + _cache_directory = os.path.join(os.getenv('XDG_CACHE_HOME') or '~/.cache', 'jedi') +cache_directory = os.path.expanduser(_cache_directory) """ The path where all the caches can be found. + +On Linux, this defaults to ``~/.cache/jedi/``, on OS X to ``~/.jedi/`` and on +Windows to ``%APPDATA%\\Jedi\\Jedi\\``. """ # ----------------