Re: [pygtk] Expected Behaviour of gnomevfs.XFER_NEW_UNIQUE_DIRECTORY



2007/4/23, John Stowers <john stowers lists gmail com>:

Hi John,

I am trying to copy files using gnomevfs using xfer_uri

I am unable to perform a copy from

foo/file1 to
foo/bar/file1

without first creating the bar directory. I thought that
gnomevfs.XFER_NEW_UNIQUE_DIRECTORY created all needed directories for
the copy - this does not seem to be the case however.

Is this a bug or a lack of my understanding? (see example code below)

since I don't think it's a problem of the python bindings I've cc'd
gnome-vfs-list, maybe you can get more help.

import gnomevfs

f1 = gnomevfs.URI("/home/john/Desktop/foo/bar.txt")
f2 = gnomevfs.URI("/home/john/Desktop/baz/Cheese/bar.txt")
f3 = gnomevfs.URI("/home/john/Desktop/baz/bar.txt")

mode = gnomevfs.XFER_OVERWRITE_MODE_REPLACE

print "Transfering File %s -> %s" % (f1, f3)
result = gnomevfs.xfer_uri(f1, f3,
                    gnomevfs.XFER_NEW_UNIQUE_DIRECTORY,
                    gnomevfs.XFER_ERROR_MODE_ABORT,
                    mode)

try:
    print "Transfering File %s -> %s" % (f1, f2)
    result = gnomevfs.xfer_uri(f1, f2,
                        gnomevfs.XFER_NEW_UNIQUE_DIRECTORY,
                        gnomevfs.XFER_ERROR_MODE_ABORT,
                        mode)
except gnomevfs.NotFoundError:
    print "STUPID GNOMEVFS BUG"

cheers
--
Gian Mario Tagliaretti



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]