Skip to content

Commit

Permalink
also check in getSystemConfigPath for config.nims
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Aug 23, 2018
1 parent 3dbf853 commit 9f1283c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
10 changes: 8 additions & 2 deletions compiler/nim.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions compiler/nimconf.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 9f1283c

Please sign in to comment.