Fixes #23695: On Linux, "nimsuggest" crashes if Nim is installed in /usr/bin and the library in /usr/lib/nim (#23697)

(Not tested)
This commit is contained in:
Juan M Gómez
2024-06-10 15:17:02 +01:00
committed by GitHub
parent 56c95758b2
commit 1cbcbd9269

View File

@@ -759,15 +759,7 @@ proc handleCmdLine(cache: IdentCache; conf: ConfigRef) =
if gMode != mstdin:
conf.writelnHook = proc (msg: string) = discard
# Find Nim's prefix dir.
let binaryPath = findExe("nim")
if binaryPath == "":
raise newException(IOError,
"Cannot find Nim standard library: Nim compiler not in PATH")
conf.prefixDir = AbsoluteDir binaryPath.splitPath().head.parentDir()
if not dirExists(conf.prefixDir / RelativeDir"lib"):
conf.prefixDir = AbsoluteDir""
conf.prefixDir = conf.getPrefixDir()
#msgs.writelnHook = proc (line: string) = log(line)
myLog("START " & conf.projectFull.string)
@@ -1341,13 +1333,7 @@ else:
conf.writelnHook = proc (msg: string) = discard
# Find Nim's prefix dir.
if nimPath == "":
let binaryPath = findExe("nim")
if binaryPath == "":
raise newException(IOError,
"Cannot find Nim standard library: Nim compiler not in PATH")
conf.prefixDir = AbsoluteDir binaryPath.splitPath().head.parentDir()
if not dirExists(conf.prefixDir / RelativeDir"lib"):
conf.prefixDir = AbsoluteDir""
conf.prefixDir = conf.getPrefixDir()
else:
conf.prefixDir = AbsoluteDir nimPath