summary refs log tree commit diff stats
path: root/lib/pure/os.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pure/os.nim')
-rw-r--r--lib/pure/os.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index 5c7d369c9..fabac8d95 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -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)