Look for user nim.cfg in "nim/" subdir in usual config dir locations (#8662)
Fixes https://github.com/nim-lang/Nim/issues/8661.
This commit is contained in:
parent
ce4383be3b
commit
d73b19e379
3 changed files with 10 additions and 3 deletions
|
|
@ -230,4 +230,11 @@
|
||||||
- On Posix systems the global system wide configuration is now put under ``/etc/nim/nim.cfg``,
|
- On Posix systems the global system wide configuration is now put under ``/etc/nim/nim.cfg``,
|
||||||
it used to be ``/etc/nim.cfg``. Usually it does not exist, however.
|
it used to be ``/etc/nim.cfg``. Usually it does not exist, however.
|
||||||
|
|
||||||
|
- On Posix systems the user configuration is now looked under ``$XDG_CONFIG_HOME/nim/nim.cfg``
|
||||||
|
(if ``XDG_CONFIG_HOME`` is not defined, then under ``~/.config/nim/nim.cfg``). It used to be
|
||||||
|
``$XDG_CONFIG_DIR/nim.cfg`` (and ``~/.config/nim.cfg``).
|
||||||
|
|
||||||
|
Similarly, on Windows, the user configuration is now looked under ``%APPDATA%/nim/nim.cfg``.
|
||||||
|
This used to be ``%APPDATA%/nim.cfg``.
|
||||||
|
|
||||||
### Bugfixes
|
### Bugfixes
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ proc readConfigFile(
|
||||||
return true
|
return true
|
||||||
|
|
||||||
proc getUserConfigPath(filename: string): string =
|
proc getUserConfigPath(filename: string): string =
|
||||||
result = joinPath(getConfigDir(), filename)
|
result = joinPath([getConfigDir(), "nim", filename])
|
||||||
|
|
||||||
proc getSystemConfigPath(conf: ConfigRef; filename: string): string =
|
proc getSystemConfigPath(conf: ConfigRef; filename: string): string =
|
||||||
# try standard configuration file (installation did not distribute files
|
# try standard configuration file (installation did not distribute files
|
||||||
|
|
|
||||||
|
|
@ -525,14 +525,14 @@ proc getConfigDir*(): string {.rtl, extern: "nos$1",
|
||||||
## 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
|
## 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
|
## spec. Thus, this proc returns the value of the XDG_CONFIG_HOME environment
|
||||||
## variable if it is set, and returns the default configuration directory,
|
## variable if it is set, and returns the default configuration directory,
|
||||||
## "~/.config/", otherwise.
|
## "~/.config/", otherwise.
|
||||||
##
|
##
|
||||||
## An OS-dependent trailing slash is always present at the end of the
|
## An OS-dependent trailing slash is always present at the end of the
|
||||||
## returned string; `\\` on Windows and `/` on all other OSs.
|
## 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_HOME"): return string(getEnv("XDG_CONFIG_HOME")) & "/"
|
||||||
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",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue