Remove expandTilde forward declaration
This commit is contained in:
parent
cdc6529ccf
commit
e0497112dc
1 changed files with 17 additions and 19 deletions
|
|
@ -1884,25 +1884,7 @@ proc getFileSize*(file: string): BiggestInt {.rtl, extern: "nos$1",
|
||||||
close(f)
|
close(f)
|
||||||
else: raiseOSError(osLastError())
|
else: raiseOSError(osLastError())
|
||||||
|
|
||||||
proc expandTilde*(path: string): string {.tags: [ReadEnvEffect].}
|
proc expandTilde*(path: string): string {.tags: [ReadEnvEffect].} =
|
||||||
|
|
||||||
proc findExe*(exe: string): string {.tags: [ReadDirEffect, ReadEnvEffect].} =
|
|
||||||
## Searches for `exe` in the current working directory and then
|
|
||||||
## in directories listed in the ``PATH`` environment variable.
|
|
||||||
## Returns "" if the `exe` cannot be found. On DOS-like platforms, `exe`
|
|
||||||
## is added the `ExeExt <#ExeExt>`_ file extension if it has none.
|
|
||||||
result = addFileExt(exe, os.ExeExt)
|
|
||||||
if existsFile(result): return
|
|
||||||
var path = string(os.getEnv("PATH"))
|
|
||||||
for candidate in split(path, PathSep):
|
|
||||||
when defined(windows):
|
|
||||||
var x = candidate / result
|
|
||||||
else:
|
|
||||||
var x = expandTilde(candidate) / result
|
|
||||||
if existsFile(x): return x
|
|
||||||
result = ""
|
|
||||||
|
|
||||||
proc expandTilde*(path: string): string =
|
|
||||||
## Expands a path starting with ``~/`` to a full path.
|
## Expands a path starting with ``~/`` to a full path.
|
||||||
##
|
##
|
||||||
## If `path` starts with the tilde character and is followed by `/` or `\\`
|
## If `path` starts with the tilde character and is followed by `/` or `\\`
|
||||||
|
|
@ -1922,6 +1904,22 @@ proc expandTilde*(path: string): string =
|
||||||
else:
|
else:
|
||||||
result = path
|
result = path
|
||||||
|
|
||||||
|
proc findExe*(exe: string): string {.tags: [ReadDirEffect, ReadEnvEffect].} =
|
||||||
|
## Searches for `exe` in the current working directory and then
|
||||||
|
## in directories listed in the ``PATH`` environment variable.
|
||||||
|
## Returns "" if the `exe` cannot be found. On DOS-like platforms, `exe`
|
||||||
|
## is added the `ExeExt <#ExeExt>`_ file extension if it has none.
|
||||||
|
result = addFileExt(exe, os.ExeExt)
|
||||||
|
if existsFile(result): return
|
||||||
|
var path = string(os.getEnv("PATH"))
|
||||||
|
for candidate in split(path, PathSep):
|
||||||
|
when defined(windows):
|
||||||
|
var x = candidate / result
|
||||||
|
else:
|
||||||
|
var x = expandTilde(candidate) / result
|
||||||
|
if existsFile(x): return x
|
||||||
|
result = ""
|
||||||
|
|
||||||
when defined(Windows):
|
when defined(Windows):
|
||||||
type
|
type
|
||||||
DeviceId* = int32
|
DeviceId* = int32
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue