diff options
-rw-r--r-- | compiler/options.nim | 2 | ||||
-rw-r--r-- | doc/nimc.rst | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/compiler/options.nim b/compiler/options.nim index be9342085..44519ea22 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -482,7 +482,7 @@ include packagehandling proc getOsCacheDir(): string = when defined(posix): - result = getHomeDir() / ".cache" + result = string getEnv("XDG_CACHE_HOME", getHomeDir() / ".cache") else: result = getHomeDir() / genSubDir diff --git a/doc/nimc.rst b/doc/nimc.rst index 277c88ec1..fca5b273c 100644 --- a/doc/nimc.rst +++ b/doc/nimc.rst @@ -159,7 +159,8 @@ Generated C code directory The generated files that Nim produces all go into a subdirectory called ``nimcache``. Its full path is -- ``~/.cache/$projectname(_r|_d)`` on Posix +- ``$XDG_CACHE_HOME/$projectname(_r|_d)`` or ``~/.cache/$projectname(_r|_d)`` + on Posix - ``$HOME/nimcache/$projectname(_r|_d)`` on Windows. The ``_r`` suffix is used for release builds, ``_d`` is for debug builds. |