Commit 88013f3f authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

improved detection of old gimp user directories and handle migration from

2007-10-31  Sven Neumann  <sven@gimp.org>

	* app/core/gimp-user-install.c: improved detection of old gimp
	user directories and handle migration from 2.4.


svn path=/trunk/; revision=24023
parent d15f7ffe
2007-10-31 Sven Neumann <sven@gimp.org>
* app/core/gimp-user-install.c: improved detection of old gimp
user directories and handle migration from 2.4.
2007-10-31 Michael Natterer <mitch@gimp.org>
* app/core/gimpparamspecs.[ch] (GimpParamSpecString): remove
......
......@@ -104,6 +104,7 @@ gimp_user_install_items[] =
};
static gboolean gimp_user_install_detect_old (GimpUserInstall *install);
static void user_install_log (GimpUserInstall *install,
const gchar *format,
...) G_GNUC_PRINTF (2, 3);
......@@ -131,54 +132,10 @@ GimpUserInstall *
gimp_user_install_new (gboolean verbose)
{
GimpUserInstall *install = g_slice_new0 (GimpUserInstall);
gchar *dir;
gchar *version;
gboolean migrate;
install->verbose = verbose;
dir = g_strdup (gimp_directory ());
version = strstr (dir, GIMP_APP_VERSION);
if (! version)
{
g_free (dir);
return install;
}
/* we assume that GIMP_APP_VERSION is in the form '2.x' */
version[2] = '2';
migrate = g_file_test (dir, G_FILE_TEST_IS_DIR);
if (migrate)
{
install->old_major = 2;
install->old_minor = 2;
}
else
{
version[2] = '0';
migrate = g_file_test (dir, G_FILE_TEST_IS_DIR);
if (migrate)
{
install->old_major = 2;
install->old_minor = 0;
}
}
if (migrate)
{
install->old_dir = dir;
install->migrate = (const gchar *) version;
}
else
{
g_free (dir);
}
gimp_user_install_detect_old (install);
return install;
}
......@@ -241,6 +198,54 @@ gimp_user_install_set_log_handler (GimpUserInstall *install,
/* Local functions */
static gboolean
gimp_user_install_detect_old (GimpUserInstall *install)
{
gchar *dir;
gchar *version;
gboolean migrate = FALSE;
dir = g_strdup (gimp_directory ());
version = strstr (dir, GIMP_APP_VERSION);
if (version)
{
gint i;
for (i = 4; i >= 0; i -= 2)
{
/* we assume that GIMP_APP_VERSION is in the form '2.x' */
g_snprintf (version + 2, 2, "%d", i);
migrate = g_file_test (dir, G_FILE_TEST_IS_DIR);
#ifdef GIMP_UNSTABLE
g_printerr ("gimp-user-install: migrating from %s\n", dir);
#endif
if (migrate)
{
install->old_major = 2;
install->old_minor = i;
break;
}
}
}
if (migrate)
{
install->old_dir = dir;
install->migrate = (const gchar *) version;
}
else
{
g_free (dir);
}
return migrate;
}
static void
user_install_log (GimpUserInstall *install,
const gchar *format,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment