diff --git a/lib/pure/os.nim b/lib/pure/os.nim index e8ece37c1..45d28c6ee 100644 --- a/lib/pure/os.nim +++ b/lib/pure/os.nim @@ -232,9 +232,9 @@ proc splitPath*(path: string): tuple[head, tail: string] {. result.tail = path when FileSystemCaseSensitive: - template `!=?`(a, b: char): bool = toLowerAscii(a) != toLowerAscii(b) -else: template `!=?`(a, b: char): bool = a != b +else: + template `!=?`(a, b: char): bool = toLowerAscii(a) != toLowerAscii(b) proc relativePath*(path, base: string; sep = DirSep): string {. noSideEffect, rtl, extern: "nos$1", raises: [].} = diff --git a/tests/stdlib/tos.nim b/tests/stdlib/tos.nim index 0a264b3fb..ab0cce8de 100644 --- a/tests/stdlib/tos.nim +++ b/tests/stdlib/tos.nim @@ -329,6 +329,10 @@ block ospaths: doAssert relativePath("/Users/me/bar/z.nim", "/Users/me", '/') == "bar/z.nim" doAssert relativePath("", "/users/moo", '/') == "" doAssert relativePath("foo", "", '/') == "foo" + doAssert relativePath("/foo", "/Foo", '/') == (when FileSystemCaseSensitive: "../foo" else: "") + doAssert relativePath("/Foo", "/foo", '/') == (when FileSystemCaseSensitive: "../Foo" else: "") + doAssert relativePath("/foo", "/fOO", '/') == (when FileSystemCaseSensitive: "../foo" else: "") + doAssert relativePath("/foO", "/foo", '/') == (when FileSystemCaseSensitive: "../foO" else: "") doAssert joinPath("usr", "") == unixToNativePath"usr/" doAssert joinPath("", "lib") == "lib"