Uses XDG_CACHE_HOME if available (#8585)

* compiler/options: use XDG_CACHE_HOME if set

* doc/nimc: update documentation
This commit is contained in:
alaviss
2018-08-09 15:50:36 +07:00
committed by Andreas Rumpf
parent 98225ca207
commit a2c5ffba0c
2 changed files with 3 additions and 2 deletions

View File

@@ -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

View File

@@ -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.