fixes #19724; don't be aggressive when you infer sink parameters (#20314)

* fixes #19724; don't be aggressive when you infer sink parameters

* better logic and updated tests

* wip

* fixes tests (#20330)

* restore tests

* try splitPath

Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
Co-authored-by: xflywind <43030857+xflywind@users.noreply.github.com>
This commit is contained in:
Andreas Rumpf 2022-09-12 00:58:29 +02:00 • committed by GitHub
commit 6bf21e7b3d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 10 deletions

View file

@ -138,11 +138,11 @@ if dirExists(this.value):
par = (dir_1: parentDir(this.value), front_1:
wasMoved(:tmpD_1)
`=copy`(:tmpD_1,
:tmpD_3 = splitPath do:
:tmpD_3 = splitDrive do:
wasMoved(:tmpD_2)
`=copy`(:tmpD_2, this.value)
:tmpD_2
:tmpD_3.tail)
:tmpD_3.path)
:tmpD_1)
`=destroy`(:tmpD_3)
if dirExists(par.dir):
@ -357,7 +357,7 @@ proc getSubDirs(parent, front: string): seq[string] = @[]
method check(this: Foo) {.base.} =
this.isValid = fileExists(this.value)
let par = if dirExists(this.value): (dir: this.value, front: "")
else: (dir: parentDir(this.value), front: splitPath(this.value).tail)
else: (dir: parentDir(this.value), front: splitDrive(this.value).path)
if dirExists(par.dir):
this.matchDirs = getSubDirs(par.dir, par.front)
else: