From 8a63caca07349742d071dcd3a7d3e3055fe617cf Mon Sep 17 00:00:00 2001 From: Andy Davidoff Date: Tue, 31 Dec 2019 16:29:19 -0500 Subject: [PATCH] fixes disruptek/nimph#102 multi-level nim.cfg use (#13001) [backport] --- compiler/nimblecmd.nim | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/compiler/nimblecmd.nim b/compiler/nimblecmd.nim index 9ef529ff31..c84a0f3c28 100644 --- a/compiler/nimblecmd.nim +++ b/compiler/nimblecmd.nim @@ -69,9 +69,10 @@ proc getPathVersion*(p: string): tuple[name, version: string] = result.version = "" const specialSeparator = "-#" - var sepIdx = p.find(specialSeparator) + let last = p.rfind(p.lastPathPart) # the index where the last path part begins + var sepIdx = p.find(specialSeparator, start = last) if sepIdx == -1: - sepIdx = p.rfind('-') + sepIdx = p.rfind('-', start = last) if sepIdx == -1: result.name = p