diff options
author | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-07-03 00:37:42 +0100 |
---|---|---|
committer | Dominik Picheta <dominikpicheta@googlemail.com> | 2015-07-03 00:37:42 +0100 |
commit | e0497112dcb2ba60b120bf7831edb1dea4a8e25e (patch) | |
tree | fb59015f2973c986a99ec40575f03285e2a2096e | |
parent | cdc6529ccfbbabebf9e0da98334e1c4ee6e3973b (diff) | |
download | Nim-e0497112dcb2ba60b120bf7831edb1dea4a8e25e.tar.gz |
Remove expandTilde forward declaration
-rw-r--r-- | lib/pure/os.nim | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim index 7ba48651e..59a56a1ab 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -1884,25 +1884,7 @@ proc getFileSize*(file: string): BiggestInt {.rtl, extern: "nos$1", close(f) else: raiseOSError(osLastError()) -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 = +proc expandTilde*(path: string): string {.tags: [ReadEnvEffect].} = ## Expands a path starting with ``~/`` to a full path. ## ## If `path` starts with the tilde character and is followed by `/` or `\\` @@ -1922,6 +1904,22 @@ proc expandTilde*(path: string): string = else: 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): type DeviceId* = int32 |