Skip to content

Commit 695fd5e

Browse files
authored
Merge pull request #8 from makermelissa/master
Fix copy issue when destination is a directory
2 parents 7ea1ad3 + a559241 commit 695fd5e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

adafruit_shell.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ def move(self, source, destination):
339339
source = self.path(source)
340340
destination = self.path(destination)
341341
if os.path.exists(source):
342+
if not os.path.isdir(source) and os.path.isdir(destination):
343+
destination += os.sep + os.path.basename(source)
342344
shutil.move(source, destination)
343345

344346
def copy(self, source, destination):
@@ -351,7 +353,9 @@ def copy(self, source, destination):
351353
if os.path.isdir(source):
352354
shutil.copytree(source, destination)
353355
else:
354-
shutil.copyfile(source, destination)
356+
if os.path.isdir(destination):
357+
destination += os.sep + os.path.basename(source)
358+
shutil.copy(source, destination)
355359

356360
def remove(self, location):
357361
"""

0 commit comments

Comments
 (0)