Storing file references in GConf



Hello,

as Havoc pointed out before, storing absolute filenames (e.g.
/home/ettore/foo/bar.txt) in GConf is evil.  If you do that, your
settings become dependant on the physical location of your home
directory, which causes trouble if you are mounting your home from
different machines, or if you are trying to migrate a bunch of
data/settings from one machine to another.  So, the right thing is to
store only a home-relative path instead (foo/bar.txt).

However, what happens if you want to store a URI, instead of a filename
(i.e. the file can be non-local)?  In that case, you'd want to be able
to specify home-relative file: URIs when the file is local...  But as
far as I know there is no standard way to do it.

I poked a few people on IRC and there were a couple options being
suggested:

      * Embed a ~ in the file: URI, e.g. file:///~/foo/bar.txt.  (This
        is not a valid URI, but at least we would be able to distinguish
        it and easily translate it into a real URI.)

      * If the URI doesn't start with a schema, assume it's a filename
        relative to your home directory, e.g. foo/bar.txt, but still
        http://www.gnome.org works as expected.

Maybe we should agree to use a scheme like these, and have the platform
provide some ways to handle this case gracefully?

E.g. Havoc suggested we could have something like
gconf_client_get_uri()/gconf_client_set_uri(), which could automatically
translate between home-relative file URIs and proper ones.  And/or we
could have GNOME VFS URI handle these out of the box.

Or maybe, in order to avoid confusion with proper URIs and filenames,
GConf could even understand these URIs-but-not-quite as special types?

I am trying to get this right for Evolution 2.0 and it would be nice if
I could use a scheme that people can at least tentatively agree on...

-- Ettore



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