From 3559d2c2a32f0eeca441a5d7581064101503d16a Mon Sep 17 00:00:00 2001 From: Tomas Bzatek Date: Thu, 20 Mar 2014 21:53:42 +0100 Subject: Use setup2.xml if present To allow combined use of different cgg versions, user may provide ver. 2 setup.xml file that takes priority over standard setup.xml file. This applies only to current working directory, not the files placed in ~/.cgg or distributed as $PREFIX/share/cgg. --- src/setup.c | 15 ++++++++++----- src/setup.h | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/setup.c b/src/setup.c index bb69993..d9b5ed3 100644 --- a/src/setup.c +++ b/src/setup.c @@ -41,16 +41,21 @@ find_setup_xml () { gchar *pth; gchar *cwd; - TGallerySetup *setup; + TGallerySetup *setup = NULL; - setup = NULL; cwd = g_get_current_dir (); - pth = g_build_filename (cwd, SETUP_XML, NULL); - g_free (cwd); - + /* Prefer setup2.xml over setup.xml but only in current working directory */ + pth = g_build_filename (cwd, SETUP_V2_XML, NULL); if (g_access (pth, R_OK) == 0) setup = parse_setup_xml (pth); g_free (pth); + if (! setup) { + pth = g_build_filename (cwd, SETUP_XML, NULL); + if (g_access (pth, R_OK) == 0) + setup = parse_setup_xml (pth); + g_free (pth); + } + g_free (cwd); if (! setup) { pth = g_build_filename (g_getenv ("HOME"), ".cgg", SETUP_XML, NULL); diff --git a/src/setup.h b/src/setup.h index 7ce2cd1..9e8f9dd 100644 --- a/src/setup.h +++ b/src/setup.h @@ -28,6 +28,7 @@ G_BEGIN_DECLS #define TARGET_IMAGE_DIR_PREFIX "_" #define SETUP_XML "setup.xml" +#define SETUP_V2_XML "setup2.xml" #define SETUP_NATIVE_VERSION 200 /* 2.0 */ -- cgit v1.2.3