added os.findExe

This commit is contained in:
Araq 2010-10-31 02:12:18 +02:00
commit 5055d30753
3 changed files with 14 additions and 12 deletions

View file

@ -14,18 +14,6 @@ when defined(tinyc):
else:
const runCmd = "c -r"
when not defined(findExe):
# candidate for the stdlib:
proc findExe(exe: string): string =
## returns exe if the exe cannot be found
result = addFileExt(exe, os.exeExt)
if ExistsFile(result): return
var path = os.getEnv("PATH")
for candidate in split(path, pathSep):
var x = candidate / result
if ExistsFile(x): return x
result = ""
var nimExe = findExe("nimrod")
if nimExe.len == 0: nimExe = "../bin" / addFileExt("nimrod", os.exeExt)