Skip to content

Commit 440196d

Browse files
committed
Fix error when pushing recursively directories. Closes Swind#54
1 parent 26a6425 commit 440196d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

ppadb/device.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,14 @@ def push(self, src, dest, mode=0o644, progress=None):
6060
elif os.path.isfile(src):
6161
self._push(src, dest, mode, progress)
6262
elif os.path.isdir(src):
63+
6364
basename = os.path.basename(src)
6465

6566
for root, dirs, files in os.walk(src):
66-
root_dir_path = os.path.join(basename, root.replace(src, ""))
67+
subdir = root.replace(src, "")
68+
if subdir.startswith("/"):
69+
subdir = subdir[1:]
70+
root_dir_path = os.path.join(basename, subdir)
6771

6872
self.shell("mkdir -p {}/{}".format(dest, root_dir_path))
6973

0 commit comments

Comments
 (0)