Skip to content

Commit

Permalink
Merge pull request #55 from iblancasa/master
Browse files Browse the repository at this point in the history
Fix error when pushing recursively directories. Closes #54
  • Loading branch information
Swind authored Aug 23, 2020
2 parents 26a6425 + 440196d commit b136202
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ppadb/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,14 @@ def push(self, src, dest, mode=0o644, progress=None):
elif os.path.isfile(src):
self._push(src, dest, mode, progress)
elif os.path.isdir(src):

basename = os.path.basename(src)

for root, dirs, files in os.walk(src):
root_dir_path = os.path.join(basename, root.replace(src, ""))
subdir = root.replace(src, "")
if subdir.startswith("/"):
subdir = subdir[1:]
root_dir_path = os.path.join(basename, subdir)

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

Expand Down

0 comments on commit b136202

Please sign in to comment.