mirror of
https://github.com/nim-lang/Nim.git
synced 2026-07-21 00:11:26 +00:00
Show error when trying to run in folder that doesn't exist instead of assertion (#23242)
Closes #23240 Fixes regression caused by #23017
This commit is contained in:
@@ -326,7 +326,8 @@ proc mainCommand*(graph: ModuleGraph) =
|
||||
# so by default should not end up in $PWD nor in $projectPath.
|
||||
var ret = if optUseNimcache in conf.globalOptions: getNimcacheDir(conf)
|
||||
else: conf.projectPath
|
||||
doAssert ret.string.isAbsolute # `AbsoluteDir` is not a real guarantee
|
||||
if not ret.string.isAbsolute: # `AbsoluteDir` is not a real guarantee
|
||||
rawMessage(conf, errCannotOpenFile, ret.string & "/")
|
||||
if conf.cmd in cmdDocLike + {cmdRst2html, cmdRst2tex, cmdMd2html, cmdMd2tex}:
|
||||
ret = ret / htmldocsDir
|
||||
conf.outDir = ret
|
||||
|
||||
6
tests/misc/t23240.nim
Normal file
6
tests/misc/t23240.nim
Normal file
@@ -0,0 +1,6 @@
|
||||
discard """
|
||||
cmd: "nim c foo/bar.nim"
|
||||
action: "reject"
|
||||
errormsg: "cannot open 'foo/'"
|
||||
file: ""
|
||||
"""
|
||||
Reference in New Issue
Block a user