GNOME Bugzilla – Bug 141901
gnome_vfs_get_mime_type does not return the correct mime type.
Last modified: 2004-12-22 21:47:04 UTC
If gnome is installed in any path other than /usr then gnome_vfs_get_mime_type will not fetch the correct mime type of the specified file.
Created attachment 27389 [details] [review] Proposed patch
I believe this is done on purpose to follow the freedesktop base dir spec (http://freedesktop.org/Standards/basedir-spec/basedir-spec-0.6.html). You need to set the XDG_DATA_DIRS env variable to get things working properly. jrb, can you confirm/infirm ?
This problem is seen in many applications like yelp, nautilus etc when Gnome is installed in non-standard location (e.g. /opt/gnome). Is 'each' application required to explicitly set the env variable before getting the mime type from gnome-vfs? ps: Setting the env variable can't be done at session-level, as user can run an app from remote display.
It's not up to each app, it's up to the user/sysadmin to properly set up the user environment. If gnome isn't installed in a standard location, you need to set LD_LIBRARY_PATH (or run ldconfig at some point), PKG_CONFIG_PATH, ACLOCAL_FLAGS, ... if you want things to work perfectly, this is the same with XDG_DATA_DIRS.
I think there's a disconnect here. Muktha is talking about building GNOME with a $prefix that is not /usr but something else, not relocating the binaries/config files that were build with a different prefix. In this case, you don't need to set LD_LIBRARY_PATH or PKG_CONFIG_PATH. (pkg-config also defaults to $libdir/pkgconfig) The spec you point to says: "- Such file should be installed to $datadir/subdir/filename with $datadir defaulting to /usr/share" In our case $datadir is not /usr/share and the file we wish to reference is in $datadir/subdir/filename. I'd even say that DATADIR should be searched first, then /usr/share and finally /usr/local/share.
I think the spec is pretty clear about that: « If $XDG_DATA_DIRS is either not set or empty, a value equal to /usr/local/share/:/usr/share/ should be used. [...] Lookups of the data file should search for ./subdir/filename relative to all base directories specified by $XDG_DATA_HOME and $XDG_DATA_DIRS . If an environment variable is either not set or empty, its default value as defined by this specification should be used instead. » If you think this is wrong, you should bring the issue up on one of the freedesktop mailing lists. I think the rationale for not taking account installation prefix at all is to make it desktop agnostic, ie if someone installs kde in /opt/kde and gnome in /opt/gnome, then they both look for the files they need in the same place.
This seems like a dup of bug 132338.