From 3ca8ebe778cb82cdbd97d7a9a00015bbeed1a696 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Thu, 16 Aug 2018 18:43:25 +0200 Subject: [PATCH] fixes #8653 --- changelog.md | 3 +++ compiler/nimconf.nim | 4 ++-- doc/nimc.rst | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/changelog.md b/changelog.md index 441b090425..73d5261362 100644 --- a/changelog.md +++ b/changelog.md @@ -227,4 +227,7 @@ compile time functions / static blocks. Only in templates / regular code it retains it's old behavior. This new feature can be accessed via {.experimental: "dynamicBindSym".} pragma/switch. +- 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. + ### Bugfixes diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim index d3b4645dce..cb7e52cf77 100644 --- a/compiler/nimconf.nim +++ b/compiler/nimconf.nim @@ -228,8 +228,8 @@ proc getSystemConfigPath(conf: ConfigRef; filename: string): string = let p = getPrefixDir(conf) result = joinPath([p, "config", filename]) when defined(unix): - if not existsFile(result): result = joinPath([p, "etc", filename]) - if not existsFile(result): result = "/etc/" & filename + if not existsFile(result): result = joinPath([p, "etc/nim", filename]) + if not existsFile(result): result = "/etc/nim/" & filename proc loadConfigs*(cfg: string; cache: IdentCache; conf: ConfigRef) = setDefaultLibpath(conf) diff --git a/doc/nimc.rst b/doc/nimc.rst index 31df4b6f78..0682fac03d 100644 --- a/doc/nimc.rst +++ b/doc/nimc.rst @@ -154,7 +154,7 @@ passed as a command line argument to the compiler. The ``nim`` executable processes configuration files in the following directories (in this order; later files overwrite previous settings): -1) ``$nim/config/nim.cfg``, ``/etc/nim.cfg`` (UNIX) or ``%NIMROD%/config/nim.cfg`` (Windows). This file can be skipped with the ``--skipCfg`` command line option. +1) ``$nim/config/nim.cfg``, ``/etc/nim/nim.cfg`` (UNIX) or ``%NIM%/config/nim.cfg`` (Windows). This file can be skipped with the ``--skipCfg`` command line option. 2) ``$HOME/.config/nim.cfg`` (POSIX) or ``%APPDATA%/nim.cfg`` (Windows). This file can be skipped with the ``--skipUserCfg`` command line option. 3) ``$parentDir/nim.cfg`` where ``$parentDir`` stands for any parent directory of the project file's path. These files can be skipped with the ``--skipParentCfg`` command line option. 4) ``$projectDir/nim.cfg`` where ``$projectDir`` stands for the project file's path. This file can be skipped with the ``--skipProjCfg`` command line option.