From 98611ba214c71ce881dd2453ecda2265dc052632 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Fri, 12 Apr 2002 18:50:48 +0000 Subject: [PATCH] more registry fixes Original commit message from CVS: more registry fixes --- DEVEL | 14 ++++++++------ gst/gstplugin.c | 10 ++++++++-- gst/gstregistry.c | 5 +++++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/DEVEL b/DEVEL index 7d7e584ee6..065f905a3c 100644 --- a/DEVEL +++ b/DEVEL @@ -1,9 +1,11 @@ Development Notes and Random Wisdom * in libs like dparams, include the respective dparam headers with -#include "dparams.h" -instead of -#include -because the latter will, if the include flags are set that way, first look -for the installed headers instead of the newest one, which is in your source -dir. + #include "dparams.h" + instead of + #include + because the latter will, if the include flags are set that way, first look + for the installed headers instead of the newest one, which is in your source + dir. + +* When doing releases, please follow the guidelines in docs diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 761d9239fa..8bdd97a535 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -64,7 +64,6 @@ void _gst_plugin_initialize (void) { GList *gst_plugin_default_paths = NULL; - struct stat stat_buf; #ifndef GST_DISABLE_REGISTRY GstRegistryRead *gst_reg; gchar *gst_registry; @@ -107,12 +106,19 @@ _gst_plugin_initialize (void) if (_gst_init_registry_write) { /* delete it before writing */ + GST_INFO (GST_CAT_PLUGIN_LOADING, " Removing registry %s if it exists", gst_registry); unlink (gst_registry); } - if (stat (gst_registry, &stat_buf) == 0) + if (g_file_test (gst_registry, G_FILE_TEST_EXISTS)) + { doc = xmlParseFile (gst_registry); + GST_INFO (GST_CAT_PLUGIN_LOADING, " Reading registry from %s", gst_registry); + } else + { + GST_INFO (GST_CAT_PLUGIN_LOADING, " Not reading registry", gst_registry); doc = NULL; + } if (!doc || !doc->xmlRootNode || diff --git a/gst/gstregistry.c b/gst/gstregistry.c index 0b13f7fa9f..5c67d8d5c6 100644 --- a/gst/gstregistry.c +++ b/gst/gstregistry.c @@ -124,6 +124,11 @@ gst_registry_read_get () { gchar *homedir = (gchar *) g_get_home_dir (); gst_reg->local_reg = g_strjoin ("/", homedir, LOCAL_REGISTRY_FILE, NULL); + if (g_file_test (gst_reg->local_reg, G_FILE_TEST_EXISTS) == FALSE) + { + /* it does not exist, so don't read from it */ + g_free (gst_reg->local_reg); + } gst_reg->global_reg = g_strdup (GLOBAL_REGISTRY_FILE); } return gst_reg;