From 527e792827497002ded742ad815c567a4a056471 Mon Sep 17 00:00:00 2001 From: hlaaftana <10591326+hlaaftana@users.noreply.github.com> Date: Thu, 12 Nov 2020 13:44:21 +0300 Subject: make var string return var char w/ BackwardsIndex (#15461) * make var string return var char w/ BackwardsIndex fixes #14497 * work around VM bug * properly workaround again --- lib/pure/pathnorm.nim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/pure/pathnorm.nim') diff --git a/lib/pure/pathnorm.nim b/lib/pure/pathnorm.nim index 5bc66f0b7..7834f8d95 100644 --- a/lib/pure/pathnorm.nim +++ b/lib/pure/pathnorm.nim @@ -69,7 +69,7 @@ proc addNormalizePath*(x: string; result: var string; state: var int; while hasNext(it, x): let b = next(it, x) if (state shr 1 == 0) and isSlash(x, b): - if result.len == 0 or result[^1] notin {DirSep, AltSep}: + if result.len == 0 or result[result.len - 1] notin {DirSep, AltSep}: result.add dirSep state = state or 1 elif isDotDot(x, b): @@ -87,13 +87,13 @@ proc addNormalizePath*(x: string; result: var string; state: var int; setLen(result, d-1) dec state, 2 else: - if result.len > 0 and result[^1] notin {DirSep, AltSep}: + if result.len > 0 and result[result.len - 1] notin {DirSep, AltSep}: result.add dirSep result.add substr(x, b[0], b[1]) elif isDot(x, b): discard "discard the dot" elif b[1] >= b[0]: - if result.len > 0 and result[^1] notin {DirSep, AltSep}: + if result.len > 0 and result[result.len - 1] notin {DirSep, AltSep}: result.add dirSep result.add substr(x, b[0], b[1]) inc state, 2 -- cgit 1.4.1-2-gfad0