1import compiler/pathutils 2import os, strutils 3 4 5doAssert AbsoluteDir"/Users/me///" / RelativeFile"z.nim" == AbsoluteFile"/Users/me/z.nim" 6doAssert AbsoluteDir"/Users/me" / RelativeFile"../z.nim" == AbsoluteFile"/Users/z.nim" 7doAssert AbsoluteDir"/Users/me/" / RelativeFile"../z.nim" == AbsoluteFile"/Users/z.nim" 8doAssert relativePath("/foo/bar.nim", "/foo/", '/') == "bar.nim" 9doAssert $RelativeDir"foo/bar" == "foo/bar" 10doAssert RelativeDir"foo/bar" == RelativeDir"foo/bar" 11doAssert RelativeFile"foo/bar".changeFileExt(".txt") == RelativeFile"foo/bar.txt" 12doAssert RelativeFile"foo/bar".addFileExt(".txt") == RelativeFile"foo/bar.txt" 13doAssert not RelativeDir"foo/bar".isEmpty 14doAssert RelativeDir"".isEmpty 15 16when defined(windows): 17 let nasty = string(AbsoluteDir(r"C:\Users\rumpf\projects\nim\tests\nimble\nimbleDir\linkedPkgs\pkgB-#head\../../simplePkgs/pkgB-#head/") / RelativeFile"pkgA/module.nim") 18 doAssert nasty.replace('/', '\\') == r"C:\Users\rumpf\projects\nim\tests\nimble\nimbleDir\simplePkgs\pkgB-#head\pkgA\module.nim" 19