summary refs log tree commit diff stats
path: root/lib/pure/pathnorm.nim
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2018-12-18 03:43:25 -0800
committerAndreas Rumpf <rumpf_a@web.de>2018-12-18 12:43:25 +0100
commit25d3539da7b1e6fd4560efcee6037df34a9c549a (patch)
tree103b05cad635b24a5124cbcc0189886b2b8374a9 /lib/pure/pathnorm.nim
parentd7d17d5ab09395f36785112286f1dc28ff02a261 (diff)
downloadNim-25d3539da7b1e6fd4560efcee6037df34a9c549a.tar.gz
[os] fix #10017 regression, fix #10025 regression (#10018)
* [os] fix #10017 regression
* [os] fix #10025 regression
Diffstat (limited to 'lib/pure/pathnorm.nim')
-rw-r--r--lib/pure/pathnorm.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/pure/pathnorm.nim b/lib/pure/pathnorm.nim
index 4a7d74bf8..ca869fd03 100644
--- a/lib/pure/pathnorm.nim
+++ b/lib/pure/pathnorm.nim
@@ -86,6 +86,7 @@ proc addNormalizePath*(x: string; result: var string; state: var int; dirSep = D
         result.add dirSep
       result.add substr(x, b[0], b[1])
       inc state, 2
+  if result == "" and x != "": result = "."
 
 proc normalizePath*(path: string; dirSep = DirSep): string =
   ## Example:
@@ -96,7 +97,7 @@ proc normalizePath*(path: string; dirSep = DirSep): string =
   ##
   ## - Turns multiple slashes into single slashes.
   ## - Resolves '/foo/../bar' to '/bar'.
-  ## - Removes './' from the path.
+  ## - Removes './' from the path (but "foo/.." becomes ".")
   result = newStringOfCap(path.len)
   var state = 0
   addNormalizePath(path, result, state, dirSep)