fix #17190 nimscript now accepts arbitrary file extensions for nim e main.customext (#17596)

* fix #17190

* cah

* merge

* Update tnimscriptwithnimext.nim

* Update tnimscriptwithmacro.nims

* Apply suggestions from code review

* Delete tnimscriptwithnimext.nim

* Update tests/tools/tnimscriptwithmacro.nims

* fix

* fix

* add a test

* Apply suggestions from code review

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* Apply suggestions from code review

* Update changelog.md

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
flywind 2021-04-01 14:05:04 +08:00 • committed by GitHub
commit 924ab3adea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 4 deletions

View file

@ -342,8 +342,6 @@ proc mainCommand*(graph: ModuleGraph) =
if conf.projectIsCmd or conf.projectIsStdin: discard
elif not fileExists(conf.projectFull):
rawMessage(conf, errGenerated, "NimScript file does not exist: " & conf.projectFull.string)
elif not conf.projectFull.string.endsWith(".nims"):
rawMessage(conf, errGenerated, "not a NimScript file: " & conf.projectFull.string)
# main NimScript logic handled in `loadConfigs`.
of cmdNop: discard
of cmdJsonscript:

View file

@ -298,11 +298,14 @@ proc loadConfigs*(cfg: RelativeFile; cache: IdentCache; conf: ConfigRef; idgen:
for filename in configFiles:
# delayed to here so that `hintConf` is honored
rawMessage(conf, hintConf, filename.string)
if scriptIsProj:
if conf.cmd == cmdNimscript:
showHintConf()
configFiles.setLen 0
if conf.cmd != cmdIdeTools:
runNimScriptIfExists(scriptFile, isMain = true)
if conf.cmd == cmdNimscript:
runNimScriptIfExists(conf.projectFull, isMain = true)
else:
runNimScriptIfExists(scriptFile, isMain = true)
else:
if not scriptIsProj:
runNimScriptIfExists(scriptFile, isMain = true)