Appended to comment
This commit is contained in:
parent
9193bcaeec
commit
a9de33643b
1 changed files with 8 additions and 0 deletions
|
|
@ -516,6 +516,14 @@ when declared(getEnv) or defined(nimscript):
|
||||||
proc getConfigDir*(): string {.rtl, extern: "nos$1",
|
proc getConfigDir*(): string {.rtl, extern: "nos$1",
|
||||||
tags: [ReadEnvEffect, ReadIOEffect].} =
|
tags: [ReadEnvEffect, ReadIOEffect].} =
|
||||||
## Returns the config directory of the current user for applications.
|
## Returns 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_DIR environment
|
||||||
|
## variable if it is set, and returns the default configuration directory,
|
||||||
|
## "~/.config/", otherwise.
|
||||||
|
##
|
||||||
|
## An OS-dependent trailing slash is always present at the end of the
|
||||||
|
## returned string; `\\` on Windows and `/` on all other OSs.
|
||||||
when defined(windows): return string(getEnv("APPDATA")) & "\\"
|
when defined(windows): return string(getEnv("APPDATA")) & "\\"
|
||||||
elif getEnv("XDG_CONFIG_DIR"): return string(getEnv("XDG_CONFIG_DIR")) & "/"
|
elif getEnv("XDG_CONFIG_DIR"): return string(getEnv("XDG_CONFIG_DIR")) & "/"
|
||||||
else: return string(getEnv("HOME")) & "/.config/"
|
else: return string(getEnv("HOME")) & "/.config/"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue