Merge pull request #5748 from J3RN/meet-xdg-base-directory-spec
Modified ospath's getConfigDir to meet XDG spec
This commit is contained in:
commit
80aa02e7f9
2 changed files with 13 additions and 0 deletions
|
|
@ -516,7 +516,16 @@ 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")) & "/"
|
||||||
else: return string(getEnv("HOME")) & "/.config/"
|
else: return string(getEnv("HOME")) & "/.config/"
|
||||||
|
|
||||||
proc getTempDir*(): string {.rtl, extern: "nos$1",
|
proc getTempDir*(): string {.rtl, extern: "nos$1",
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,10 @@ Changes affecting backwards compatibility
|
||||||
compile-time value.
|
compile-time value.
|
||||||
- On posix, the results of `waitForExit`, `peekExitCode`, `execCmd` will return
|
- On posix, the results of `waitForExit`, `peekExitCode`, `execCmd` will return
|
||||||
128 + signal number if the application terminates via signal.
|
128 + signal number if the application terminates via signal.
|
||||||
|
- ``ospaths.getConfigDir`` now conforms to the XDG Base Directory specification
|
||||||
|
on non-Windows OSs. It returns the value of the XDG_CONFIG_DIR environment
|
||||||
|
variable if it is set, and returns the default configuration directory,
|
||||||
|
"~/.config/", otherwise.
|
||||||
|
|
||||||
Library Additions
|
Library Additions
|
||||||
-----------------
|
-----------------
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue