From 9f1283c5dc9f4020c7ee57be1132d0c6ae7b1522 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Thu, 23 Aug 2018 16:30:33 -0700 Subject: [PATCH] also check in getSystemConfigPath for config.nims --- compiler/nim.nim | 10 ++++++++-- compiler/nimconf.nim | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/compiler/nim.nim b/compiler/nim.nim index 0b69a940e529b..9af642bccbaec 100644 --- a/compiler/nim.nim +++ b/compiler/nim.nim @@ -85,8 +85,14 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) = if fileExists(scriptFile): runNimScript(cache, scriptFile, freshDefines=false, conf) - runNimScriptIfExists(getConfigDir() / "nim" / "config.nims") - runNimScriptIfExists(conf.projectPath / "config.nims") + # TODO: + # merge this complex logic with `loadConfigs` + # check whether these should be controlled via + # optSkipConfigFile, optSkipUserConfigFile + let config_nims = "config.nims" + runNimScriptIfExists(getSystemConfigPath(conf, config_nims)) + runNimScriptIfExists(getUserConfigPath(config_nims)) + runNimScriptIfExists(conf.projectPath / config_nims) block: let scriptFile = conf.projectFull.changeFileExt("nims") runNimScriptIfExists(scriptFile) diff --git a/compiler/nimconf.nim b/compiler/nimconf.nim index 1a8a0acb5bcb0..d26ed5deb6ea2 100644 --- a/compiler/nimconf.nim +++ b/compiler/nimconf.nim @@ -219,10 +219,10 @@ proc readConfigFile( closeLexer(L) return true -proc getUserConfigPath(filename: string): string = +proc getUserConfigPath*(filename: string): string = 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 # the UNIX way) let p = getPrefixDir(conf)