Merge pull request #8 from makermelissa/master
Fix copy issue when destination is a directory
This commit is contained in:
commit
695fd5e69f
1 changed files with 5 additions and 1 deletions
|
|
@ -339,6 +339,8 @@ class Shell:
|
|||
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):
|
||||
|
|
@ -351,7 +353,9 @@ class Shell:
|
|||
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):
|
||||
"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue