mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-21 23:05:27 +00:00
Fix #9126: use splitPath instead of substr
This commit is contained in:
@@ -1048,7 +1048,7 @@ proc copyDir*(source, dest: string) {.rtl, extern: "nos$1",
|
||||
## these platforms use `copyDirWithPermissions() <#copyDirWithPermissions>`_.
|
||||
createDir(dest)
|
||||
for kind, path in walkDir(source):
|
||||
var noSource = path.substr(source.len()+1)
|
||||
var noSource = splitPath(path).tail
|
||||
case kind
|
||||
of pcFile:
|
||||
copyFile(path, dest / noSource)
|
||||
@@ -1232,7 +1232,7 @@ proc copyDirWithPermissions*(source, dest: string,
|
||||
if not ignorePermissionErrors:
|
||||
raise
|
||||
for kind, path in walkDir(source):
|
||||
var noSource = path.substr(source.len()+1)
|
||||
var noSource = splitPath(path).tail
|
||||
case kind
|
||||
of pcFile:
|
||||
copyFileWithPermissions(path, dest / noSource, ignorePermissionErrors)
|
||||
|
||||
Reference in New Issue
Block a user