Specifying the path for mime-info files.



Hey there. :)

I noticed  that libgnomevfs library  1.0.5 looks for mime-info  files in
two  locations: GNOME_VFS_DATADIR (a  C  preprocessor  symbol that  gets
hardcoded into the library) and ~/.gnome/mime-files.

I've been seeing  how to make GNOME  play nicely with GNU stow  so it is
possible to install each of  GNOME's packages into a different directory
and use  environment variables  and similar mechanism  to make  it work.
I'm creating a document with instructions on how to do this.

Unfortunately, as libgnomevfs has the system directory for the mime-info
files hardcoded,  it is impossible  for the user  to specify it.   In my
situation,  I  would  like  libgnomevfs  to  look  for  these  files  in
/usr/local/share/mime-info rather  that in the datadir  for the location
on which the gnome-vfs package was installed.

Attached   is   a  trivially   simple   patch   that  fixes   this   and
causes  gnome-vfs  to  look  in  the  directory  specified  through  the
GNOME_VFS_DATADIR  environment variable  (this  environment variable  is
checked at run time rather than at compile time).

The  only other  viable  solution  involves forcing  the  admin to  keep
the  mime-info files  in gnome-vfs'  prefix  updated with  links to  all
the  files in  the  GNOME directory.   I'd rather  go  for specifing  an
environment variable, specially as a  similar mechanism has already been
implemented  for  similar  GNOME  packages (through  variables  such  as
GNOMEDIR,  GNOME_PATH,  GNOME_LIBCONFIG_PATH, GNOME_GNORBA_PATH  and  so
on).

Notice that this makes it possible  for the user to override the default
system directory for  mime-info files, which shouldn't  matter (but then
again I am not familiar with gnome-vfs ins and outs).

Please let  me know if I  can expect my  changes to get included  in the
next official  release so I will  know what to write  in my instructions
document.

Thanks. :)

Alejo.
http://bachue.com/alejo

--
The mere formulation of a problem is far more essential than its solution.
      -- Albert Einstein.

$0='!/sfldbi!yjoV0msfQ!sfiupob!utvK'x44;print map{("\e[7m \e[0m",chr ord
(chop$0)-1)[$_].("\n")[++$i%77]}split//,unpack'B*',pack'H*',($F='F'x19).
"F0F3E0607879CC1E0F0F339F3FF399C666733333CCF87F99E6133999999E67CFFCCF3".
"219CC1CCC033E7E660198CCE4E66798303873CCE60F3387$F"#Don't you love Perl?
diff -Naur gnome-vfs-1.0.5/libgnomevfs/gnome-vfs-mime-info.c gnome-vfs-1.0.5-alejo/libgnomevfs/gnome-vfs-mime-info.c
--- gnome-vfs-1.0.5/libgnomevfs/gnome-vfs-mime-info.c	Fri Mar 15 03:33:01 2002
+++ gnome-vfs-1.0.5-alejo/libgnomevfs/gnome-vfs-mime-info.c	Thu May  9 05:40:53 2002
@@ -969,6 +969,8 @@
 static void
 gnome_vfs_mime_init (void)
 {
+	char *gnome_dir = getenv("GNOME_VFS_DATADIR");
+
 	/*
 	 * The hash tables that store the mime keys.
 	 */
@@ -984,7 +986,7 @@
 	 * Setup the descriptors for the information loading
 	 */
 
-	gnome_mime_dir.dirname = g_strconcat (GNOME_VFS_DATADIR, "/mime-info", NULL);
+	gnome_mime_dir.dirname = g_strconcat (gnome_dir ? gnome_dir : GNOME_VFS_DATADIR, "/mime-info", NULL);
 	gnome_mime_dir.system_dir = TRUE;
 	
 	user_mime_dir.dirname  = g_strconcat (g_get_home_dir(), "/.gnome/mime-info", NULL);

Attachment: pgpOEfhzdy1RH.pgp
Description: PGP signature



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