Skip to content

Commit

Permalink
perf(walk): move some processing inside proceed check
Browse files Browse the repository at this point in the history
  • Loading branch information
haltcase committed Jul 21, 2018
1 parent 76e1582 commit cfabbea
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/glob.nim
Original file line number Diff line number Diff line change
Expand Up @@ -423,16 +423,16 @@ iterator walkGlobKinds* (
of pcLinkToFile:
if FileLinks in options: push(path, kind, internalRoot)

var dir: string
when pattern is Glob:
dir = maybeJoin(internalRoot, pattern.base)
matchPattern = pattern.magic.expandGlob(IgnoreCase in options)
else:
let stems = splitPattern(matchPattern)
dir = maybeJoin(internalRoot, stems.base)
matchPattern = stems.magic

if proceed:
var dir: string
when pattern is Glob:
dir = maybeJoin(internalRoot, pattern.base)
matchPattern = pattern.magic.expandGlob(IgnoreCase in options)
else:
let stems = splitPattern(matchPattern)
dir = maybeJoin(internalRoot, stems.base)
matchPattern = stems.magic

let matcher = matchPattern.globToRegex(ignoreCase = IgnoreCase in options)
let isRec = "**" in matchPattern

Expand Down

0 comments on commit cfabbea

Please sign in to comment.