Skip to content

Commit

Permalink
Show error when trying to run in folder that doesn't exist instead of…
Browse files Browse the repository at this point in the history
… assertion (#23242)

Closes #23240

Fixes regression caused by #23017
  • Loading branch information
ire4ever1190 authored Jan 23, 2024
1 parent ee984f8 commit 06b9e60
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions tests/misc/t23240.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
discard """
cmd: "nim c foo/bar.nim"
action: "reject"
errormsg: "cannot open 'foo/'"
file: ""
"""

0 comments on commit 06b9e60

Please sign in to comment.