Chapter 8: GnomeVFS


GnomeVFS is a library and module set that provides virtual file systems for GNOME applications. Why you should use a virtual, abstract file system and not your system's native file system? In addition to the usual justification of abstraction (portability), GnomeVFS extends the file system beyond your local disk. For example, you can access archives and web servers with the same interface as your local file system.

GnomeVFS also offers a number of practical utility functions, including an entire subsystem for asynchronous access (see Section 8.5).

8.1 Transparency with URIs

The two governing principles behind GnomeVFS are

  • A URI identifies directories and files.

  • Access is transparent; all API functions use the same URI-based format regardless of what and where the files are.

Modules support underlying media types, so you can easily outfit GnomeVFS with new access capabilities. A system with gnome-vfs and gnome-vfs-extras already contains modules for these formats:

  • a : Static C library archives.

  • all-applications : The GNOME application menu (single directory).

  • all-preferences : GNOME application preferences (single directory).

  • applications : The GNOME applications menu (directory hierarchy).

  • ar : Generic ar archives.

  • arj : arj archives.

  • bzip2 : bzip2 archives.

  • cdda : Audio compact disc information database.

  • cdemenu : CDE applications menu (for example, a Solaris menu).

  • cpio : CPIO archives.

  • deb : Debian packages.

  • favorites : GNOME favorites menu.

  • file : Local file system.

  • ftp : FTP sites.

  • gzip , ugzip : GNU Zip archives.

  • hp48 : Hewlett-Packard model HP48 calculators .

  • http : Websites.

  • lha : LHA archives.

  • mailfs : Berkeley mbox format (may be compressed).

  • nttp : Usenet news service.

  • patchfs : Patches.

  • pipe : Command I/O.

  • preferences : GNOME application preferences (directory hierarchy).

  • rar : RAR archives.

  • rio500 : Diamond Rio 500 MP3 player.

  • rpm , rpms , trpm : Red Hat Package Manager archives.

  • tar : tar archives.

  • smb : CIFS (Windows) shares.

  • ssh : Remote systems with SSH.

  • start-here : The GNOME Start Here directory.

  • system-settings : GNOME system settings.

  • zip : PKZIP archives.

  • zoo : ZOO archives.

To construct a URI, start with one of the preceding identifiers followed by a colon (:). If you need a remote machine name , username, and/or password, add two slashes ( // ) and the appropriate information (for a local file, just use two slashes). Then, to specify the filename, add the absolute path .

GnomeVFS allows nested access types. To specify an additional access type type on a file, add #type to the URI. If your target happens to be an archive (or similar), you can append another path component. Here are some examples:

  • file:///home/ walter /stairway.crd

    A local file.

  • file:///home/walter/stairway.ps.gz#gzip

    A local file compressed with GNU Zip. Adding the #gzip applies decompression and compression so that the file appears uncompressed on the user side.

  • file:///home/walter/dublin78.tar.gz#gzip#tar/dublin78/highwaystar.tab

    A file inside a compressed tar archive.

  • http://www.example.com/mosh-1.tar.gz#gzip#tar/mosh-1/README

    A file inside an archive on a web server.

  • < ftp://headbanger:daanimal37@ftp.example.com/people/headbanger/fest2-setlist >

    A file on an FTP site (including username and password).




The Official GNOME 2 Developers Guide
The Official GNOME 2 Developers Guide
ISBN: 1593270305
EAN: 2147483647
Year: 2004
Pages: 108

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net