audiobookshelf: 2.18.1 -> 2.19.0 (#378967)
[NixPkgs.git] / pkgs / by-name / ni / nim-unwrapped-2_2 / NIM_CONFIG_DIR.patch
blob61e05b791cf8cd78d8d81574fb73d90f0ae258e5
1 diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim
2 index a470179bd..73cfa1a23 100644
3 --- a/compiler/nimconf.nim
4 +++ b/compiler/nimconf.nim
5 @@ -225,10 +225,15 @@ proc getUserConfigPath*(filename: RelativeFile): AbsoluteFile =
6 proc getSystemConfigPath*(conf: ConfigRef; filename: RelativeFile): AbsoluteFile =
7 # try standard configuration file (installation did not distribute files
8 # the UNIX way)
9 - let p = getPrefixDir(conf)
10 - result = p / RelativeDir"config" / filename
11 + let
12 + prefix = getPrefixDir(conf)
13 + env = getEnv("NIM_CONFIG_PATH")
14 + if env != "":
15 + result = env.toAbsoluteDir / filename
16 + else:
17 + result = prefix / RelativeDir"config" / filename
18 when defined(unix):
19 - if not fileExists(result): result = p / RelativeDir"etc/nim" / filename
20 + if not fileExists(result): result = prefix / RelativeDir"etc/nim" / filename
21 if not fileExists(result): result = AbsoluteDir"/etc/nim" / filename
23 proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef) =