Martin Pool wrote:
> 2009/9/24 Denis Golovan <email address hidden>:
>> ** Attachment added: "Patch for 1.17/1.18"
>> http://launchpadlibrarian.net/32330771/cross-partition.patch
>
> Hi, thanks for the patch. Please push up a branch and propose a merge.
>
>
I'll just do a quick comment.
Using 'shutil.move' seems nice, except instead of failing if the target
is a directory, it will move into a subdirectory.
This is the shutil code:
real_dst = dst
if os.path.isdir(dst):
real_dst = os.path.join(dst, _basename(src))
if os.path.exists(real_dst):
raise Error, "Destination path '%s' already exists" % real_dst
^- we don't want this
v- we do what this
try: os.rename(src, real_dst)
except OSError:
if os.path.isdir(src):
if destinsrc(src, dst): raise Error, "Cannot move a directory '%s' into itself
'%s'." % (src, dst) copytree(src, real_dst, symlinks=True) rmtree(src)
else: copy2(src, real_dst) os.unlink(src)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote: launchpadlibrar ian.net/ 32330771/ cross-partition .patch
> 2009/9/24 Denis Golovan <email address hidden>:
>> ** Attachment added: "Patch for 1.17/1.18"
>> http://
>
> Hi, thanks for the patch. Please push up a branch and propose a merge.
>
>
I'll just do a quick comment.
Using 'shutil.move' seems nice, except instead of failing if the target
is a directory, it will move into a subdirectory.
This is the shutil code: exists( real_dst) :
real_dst = dst
if os.path.isdir(dst):
real_dst = os.path.join(dst, _basename(src))
if os.path.
raise Error, "Destination path '%s' already exists" % real_dst
^- we don't want this
v- we do what this
try:
os.rename( src, real_dst)
raise Error, "Cannot move a directory '%s' into itself
copytree( src, real_dst, symlinks=True)
rmtree( src)
copy2( src, real_dst)
os. unlink( src)
except OSError:
if os.path.isdir(src):
if destinsrc(src, dst):
'%s'." % (src, dst)
else:
John enigmail. mozdev. org/
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkq 7nfAACgkQJdeBCY SNAAPb7ACeNvXpa qyJVB0K82pGjW2E 34ff WUbpr4hWXi+ /02970
SOEAoI8YFmkTReS
=khPk
-----END PGP SIGNATURE-----