Re: #tar chaining



Le ven 24/01/2003 à 18:29, Gustavo Noronha Silva a écrit :
> Hi friends,
> 
> I was trying to see a tar.gz with nautilus. I was actually reading some
> developer-oriented documentation and came across an example like this:
> 
> file:///home/kov/download/koth.tar.gz#gzip#tar/src/hello.c
> 
> Using this:
> 
> file:///home/kov/download/koth.tar#tar/
> 
> Nautilus simply keeps 'doing something' and nothing happens.
> 
> I then wrote this code:
> 
> #!/usr/bin/python
> 
> import pygtk
> pygtk.require ('2.0')
> 
> import gnome
> from gnome import vfs
> 
> import os
> 
> uri = vfs.URI ('file:///home/kov/download/koth-0.7.7.tar#tar/')
> 
> arquivo = vfs.open (uri, vfs.OPEN_READ)
> str = arquivo.read (arquivo.get_file_info().size)
> 
> tar = os.popen('tar xv', 'w')
> tar.write (str)
> 
> arquivo.close ()
> 
> As you see I have to pass 'str' to a real tar command to be able to
> extract it. If I understand gnome-vfs correctly, I should be able
> to open that URI as a directory, but vfs.open_directory is not
> possible:
> 
> >>> uri.toplevel
> <gnome.vfs.URI 'file:///home/kov/download/koth-0.7.7.tar#tar/'>
> >>> h = vfs.open_directory (uri)
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
> gnome.vfs.error: Not a directory
> 
> Is the chaining simply not working? Nautilus actually *does* open
> libtar.so when 'doing something', and using #gzip on a error.txt.gz
> file gives me the same results.
> 
> I am trying to understand all this methods, modules and vfs stuff
> as a programmer. As I understand it, implementing the right stuff
> on gnome-vfs should have nautilus working properly with no extra
> code. Right?


Yes, you are right, as I understand it, the gzip and tar methods should
work as you say. However, I never managed to use them that way... :)
(sorry for not being more helpful). For your tests, you can also use
test-directory which comes with gnome-vfs.

Christophe




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