fixex merge conflicts
This commit is contained in:
commit
8e9551b1c7
53 changed files with 2648 additions and 355 deletions
|
|
@ -201,7 +201,8 @@ proc parseAssignment(L: var TLexer, tok: var TToken;
|
|||
else:
|
||||
processSwitch(s, val, passPP, info, config)
|
||||
|
||||
proc readConfigFile(filename: string; cache: IdentCache; config: ConfigRef) =
|
||||
proc readConfigFile(
|
||||
filename: string; cache: IdentCache; config: ConfigRef): bool =
|
||||
var
|
||||
L: TLexer
|
||||
tok: TToken
|
||||
|
|
@ -216,7 +217,7 @@ proc readConfigFile(filename: string; cache: IdentCache; config: ConfigRef) =
|
|||
while tok.tokType != tkEof: parseAssignment(L, tok, config, condStack)
|
||||
if len(condStack) > 0: lexMessage(L, errGenerated, "expected @end")
|
||||
closeLexer(L)
|
||||
rawMessage(config, hintConf, filename)
|
||||
return true
|
||||
|
||||
proc getUserConfigPath(filename: string): string =
|
||||
result = joinPath(getConfigDir(), filename)
|
||||
|
|
@ -233,23 +234,33 @@ proc getSystemConfigPath(conf: ConfigRef; filename: string): string =
|
|||
proc loadConfigs*(cfg: string; cache: IdentCache; conf: ConfigRef) =
|
||||
setDefaultLibpath(conf)
|
||||
|
||||
var configFiles = newSeq[string]()
|
||||
|
||||
template readConfigFile(path: string) =
|
||||
let configPath = path
|
||||
if readConfigFile(configPath, cache, conf):
|
||||
add(configFiles, configPath)
|
||||
|
||||
if optSkipConfigFile notin conf.globalOptions:
|
||||
readConfigFile(getSystemConfigPath(conf, cfg), cache, conf)
|
||||
readConfigFile(getSystemConfigPath(conf, cfg))
|
||||
|
||||
if optSkipUserConfigFile notin conf.globalOptions:
|
||||
readConfigFile(getUserConfigPath(cfg), cache, conf)
|
||||
readConfigFile(getUserConfigPath(cfg))
|
||||
|
||||
let pd = if conf.projectPath.len > 0: conf.projectPath else: getCurrentDir()
|
||||
if optSkipParentConfigFiles notin conf.globalOptions:
|
||||
for dir in parentDirs(pd, fromRoot=true, inclusive=false):
|
||||
readConfigFile(dir / cfg, cache, conf)
|
||||
readConfigFile(dir / cfg)
|
||||
|
||||
if optSkipProjConfigFile notin conf.globalOptions:
|
||||
readConfigFile(pd / cfg, cache, conf)
|
||||
readConfigFile(pd / cfg)
|
||||
|
||||
if conf.projectName.len != 0:
|
||||
# new project wide config file:
|
||||
var projectConfig = changeFileExt(conf.projectFull, "nimcfg")
|
||||
if not fileExists(projectConfig):
|
||||
projectConfig = changeFileExt(conf.projectFull, "nim.cfg")
|
||||
readConfigFile(projectConfig, cache, conf)
|
||||
readConfigFile(projectConfig)
|
||||
|
||||
for filename in configFiles:
|
||||
rawMessage(conf, hintConf, filename)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue