Skip to content

Commit

Permalink
Merge pull request #8 from makermelissa/master
Browse files Browse the repository at this point in the history
Fix copy issue when destination is a directory
  • Loading branch information
makermelissa authored Jan 26, 2021
2 parents 7ea1ad3 + a559241 commit 695fd5e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion adafruit_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ def move(self, source, destination):
source = self.path(source)
destination = self.path(destination)
if os.path.exists(source):
if not os.path.isdir(source) and os.path.isdir(destination):
destination += os.sep + os.path.basename(source)
shutil.move(source, destination)

def copy(self, source, destination):
Expand All @@ -351,7 +353,9 @@ def copy(self, source, destination):
if os.path.isdir(source):
shutil.copytree(source, destination)
else:
shutil.copyfile(source, destination)
if os.path.isdir(destination):
destination += os.sep + os.path.basename(source)
shutil.copy(source, destination)

def remove(self, location):
"""
Expand Down

0 comments on commit 695fd5e

Please sign in to comment.