@@ -297,23 +297,23 @@ proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef; idgen:
297297
298298 let pd = if not conf.projectPath.isEmpty: conf.projectPath else : AbsoluteDir (getCurrentDir ())
299299 if optSkipParentConfigFiles notin conf.globalOptions and not configEnablesSkipParent (conf, cache, pd / cfg):
300- var parentDirsSeq : seq [AbsoluteDir ] = @ []
300+ var parentDirs : seq [tuple [path: AbsoluteDir , hasNs: bool ] ] = @ []
301301 for dir in parentDirs (pd.string , inclusive= false ):
302- let
303- adir = AbsoluteDir (dir)
304- cfgPath = adir / cfg
305- if not fileExists (cfgPath):
302+ var thisReg = (path: AbsoluteDir (dir), hasNs: false )
303+ let cfgPath = thisReg.path / cfg
304+ if cfg == DefaultConfig :
305+ thisReg.hasNs = fileExists (thisReg.path / DefaultConfigNims )
306+ if not (thisReg.hasNs or fileExists (cfgPath)):
306307 continue
307- parentDirsSeq .add adir
308+ parentDirs .add thisReg
308309 if configEnablesSkipParent (conf, cache, cfgPath):
309310 break
310311
311- for i in countdown (parentDirsSeq.len - 1 , 0 ):
312- let parentDir = parentDirsSeq[i]
313- readConfigFile (parentDir / cfg)
314-
315- if cfg == DefaultConfig :
316- runNimScriptIfExists (parentDir / DefaultConfigNims )
312+ for i in countdown (parentDirs.len - 1 , 0 ):
313+ let thisReg = parentDirs[i]
314+ readConfigFile (thisReg.path / cfg)
315+ if thisReg.hasNs:
316+ runNimScriptIfExists (thisReg.path / DefaultConfigNims )
317317
318318 if optSkipProjConfigFile notin conf.globalOptions:
319319 readConfigFile (pd / cfg)
0 commit comments