Fix path trimming for copytree

This commit is contained in:
LexManos 2012-08-04 20:36:27 -07:00
parent e92be964fd
commit 7e68b53196
1 changed files with 2 additions and 2 deletions

View File

@ -385,7 +385,7 @@ def copytree(src, dst, verbose=0, symlinks=False):
""" """
if verbose == -1: if verbose == -1:
verbose = len(os.path.abspath(dst)) - 1 verbose = len(os.path.abspath(dst)) + 1
names = os.listdir(src) names = os.listdir(src)
# os.makedirs(dst) # os.makedirs(dst)
_mkdir(dst) # XXX _mkdir(dst) # XXX
@ -402,7 +402,7 @@ def copytree(src, dst, verbose=0, symlinks=False):
else: else:
shutil.copy2(srcname, dstname) shutil.copy2(srcname, dstname)
if verbose > 0: if verbose > 0:
print os.path.abspath(srcname)[verbose:] print os.path.abspath(dstname)[verbose:]
# XXX What about devices, sockets etc.? # XXX What about devices, sockets etc.?
except (IOError, os.error), why: except (IOError, os.error), why:
errors.append((srcname, dstname, str(why))) errors.append((srcname, dstname, str(why)))