diff options
| author | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2014-03-20 21:16:59 +0100 |
|---|---|---|
| committer | Tomas Bzatek <tbzatek@users.sourceforge.net> | 2014-03-21 10:08:16 +0100 |
| commit | d3d5bb1dfc21ac30b77fc4484ff942d0a9100275 (patch) | |
| tree | d6398d9f762a53aea52e8685916f80ec05f8220b /src/cgg.c | |
| parent | 050e064c40dafe1e90307870e02ad29815fe9f74 (diff) | |
| download | cataract-d3d5bb1dfc21ac30b77fc4484ff942d0a9100275.tar.xz | |
Make setup files versioned and add fallback for old versions
This commit makes setup files (setup.xml and referenced design
setup xml file) versioned and adds checks for correct versions.
If a newer versioned file is detected, warning is printed out
in assumption that a stray cgg version is used.
If the version information is missing or is lower than expected
version, files are read in legacy mode. Some values are left
on defaults and missing mandatory values are either read from
renamed keys or made up to suit current requirements.
This essentially brings back compatibility with old setup.xml
files that are usually part of galleries.
However, some values are hardcoded and should be kept in mind
to update and test the legacy mode along with future enhancements.
Diffstat (limited to 'src/cgg.c')
| -rw-r--r-- | src/cgg.c | 24 |
1 files changed, 20 insertions, 4 deletions
@@ -151,11 +151,23 @@ main (int argc, char* argv[]) fprintf (stderr, "error: could not parse gallery settings file\n"); return -2; } - setup->design = parse_design_setup_xml (setup->design_setup_file); - if (! setup->design) { - fprintf (stderr, "error: could not parse design setup file\n"); - return -6; + + if (SETUP_IS_LEGACY (setup)) { + /* Design legacy mode */ + setup->design = makeup_legacy_design (setup->setup_xml_path); + if (! setup->design) { + fprintf (stderr, "error: could not parse design from legacy setup file\n"); + return -6; + } + } else { + /* Design native mode */ + setup->design = parse_design_setup_xml (setup->design_setup_file); + if (! setup->design) { + fprintf (stderr, "error: could not parse design setup file\n"); + return -6; + } } + if (! validate_design_setup (setup->design)) return -7; @@ -174,6 +186,10 @@ main (int argc, char* argv[]) if (verbose) { printf ("cgg v%s [%s]\n\n", VERSION, APP_BUILD_DATE); printf ("Using setup file \"%s\"\n", setup->setup_xml_path); + if (SETUP_IS_NEWER (setup)) + printf ("WARNING: Reported setup.xml version is greater than current cgg engine, consider upgrading or expect random issues\n"); + if (SETUP_IS_LEGACY (setup)) + printf ("WARNING: Parsing setup.xml in legacy mode\n"); } /* Setup number of threads */ |
