osappdirs
nimony/lib/std/private/osappdirs.nim
.. importdoc:: paths.nim, dirs.nim
proc getHomeDir(): stringReturns the home directory of the current user.
This proc is wrapped by the
expandTilde proc_ for the convenience of processing paths coming from user configuration files.See also:
getDataDir proc_getConfigDir proc_getTempDir proc_expandTilde proc_getCurrentDir proc_setCurrentDir proc_
proc getDataDir(): stringReturns the data directory of the current user for applications.
On non-Windows OSs, this proc conforms to the XDG Base Directory spec. Thus, this proc returns the value of the
XDG_DATA_HOMEenvironment variable if it is set, otherwise it returns the default configuration directory ("~/.local/share" or "~/Library/Application Support" on macOS).See also:
getHomeDir proc_getConfigDir proc_getTempDir proc_expandTilde proc_getCurrentDir proc_setCurrentDir proc_
proc getConfigDir(): stringReturns the config directory of the current user for applications.
On non-Windows OSs, this proc conforms to the XDG Base Directory spec. Thus, this proc returns the value of the
XDG_CONFIG_HOMEenvironment variable if it is set, otherwise it returns the default configuration directory ("~/.config/").An OS-dependent trailing slash is always present at the end of the returned string:
\\on Windows and/on all other OSs.See also:
getHomeDir proc_getDataDir proc_getTempDir proc_expandTilde proc_getCurrentDir proc_setCurrentDir proc_
proc getCacheDir(): stringReturns the cache directory of the current user for applications.
This makes use of the following environment variables:
- On Windows:
getEnv("LOCALAPPDATA")
- On macOS:
getEnv("XDG_CACHE_HOME", getEnv("HOME") / "Library/Caches")
- On other platforms:
getEnv("XDG_CACHE_HOME", getEnv("HOME") / ".cache")
See also:
getHomeDir proc_getTempDir proc_getConfigDir proc_getDataDir proc_
- On Windows:
proc getCacheDir(app: string): stringReturns the cache directory for an application
app.- On Windows, this uses:
getCacheDir() / app / "cache" - On other platforms, this uses:
getCacheDir() / app
- On Windows, this uses:
proc getTempDir(): stringReturns the temporary directory of the current user for applications to save temporary files in.
On Windows, it calls GetTempPath. On Posix based platforms, it will check
TMPDIR,TEMP,TMPandTEMPDIRenvironment variables in order. On all platforms,/tmpwill be returned if the procs fails.You can override this implementation by adding
-d:tempDir=mytempnameto your compiler invocation.Note: This proc does not check whether the returned path exists.
See also:
getHomeDir proc_getConfigDir proc_expandTilde proc_getCurrentDir proc_setCurrentDir proc_