mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-31 18:32:11 +00:00
implemented --nimcache config option; big clean up of magic words
This commit is contained in:
@@ -512,6 +512,21 @@ proc cmpPaths*(pathA, pathB: string): int {.
|
||||
else:
|
||||
result = cmpIgnoreCase(pathA, pathB)
|
||||
|
||||
proc isAbsolute*(path: string): bool {.rtl, noSideEffect, extern: "nos$1".} =
|
||||
## Checks whether a given path is absolute.
|
||||
##
|
||||
## on Windows, network paths are considered absolute too.
|
||||
var len = len(path)
|
||||
when doslike:
|
||||
result = (len > 1 and path[0] in {'/', '\\'}) or
|
||||
(len > 2 and path[0] in Letters and path[1] == ':')
|
||||
elif defined(macos):
|
||||
result = len > 0 and path[0] != ':'
|
||||
elif defined(RISCOS):
|
||||
result = path[0] == '$'
|
||||
elif defined(posix):
|
||||
result = path[0] == '/'
|
||||
|
||||
proc sameFile*(path1, path2: string): bool {.rtl, extern: "nos$1".} =
|
||||
## Returns True if both pathname arguments refer to the same file or
|
||||
## directory (as indicated by device number and i-node number).
|
||||
|
||||
Reference in New Issue
Block a user