summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2020-01-21 06:48:19 -0800
committerAndreas Rumpf <rumpf_a@web.de>2020-01-21 15:48:19 +0100
commitb355ef2a72086126e21187303f1d2d158f52f6a8 (patch)
tree154ae43a2e38b29be56305d508369212eacf9cd1 /lib
parentbf96d6d316b4efdb219633947f05b45a5a76620b (diff)
downloadNim-b355ef2a72086126e21187303f1d2d158f52f6a8.tar.gz
fix #13211 relativePath("foo", ".") (#13213)
Diffstat (limited to 'lib')
-rw-r--r--lib/pure/os.nim2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index a6b6ccffe..3b1421cb5 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -353,8 +353,10 @@ proc relativePath*(path, base: string; sep = DirSep): string {.
     assert relativePath("/Users///me/bar//z.nim", "//Users/", '/') == "me/bar/z.nim"
     assert relativePath("/Users/me/bar/z.nim", "/Users/me", '/') == "bar/z.nim"
     assert relativePath("", "/users/moo", '/') == ""
+    assert relativePath("foo", ".", '/') == "foo"
 
   if path.len == 0: return ""
+  let base = if base == ".": "" else: base
 
   when doslikeFileSystem:
     if isAbsolute(path) and isAbsolute(base):