workaround for bug #167973: if no valid home directory exists, use the

2005-02-21  Sven Neumann  <sven@gimp.org>

	* libgimpthumb/gimpthumb-utils.c (gimp_thumb_init): workaround for
	bug #167973: if no valid home directory exists, use the folder for
	temporary files to store thumbnails.
This commit is contained in:
Sven Neumann 2005-02-21 13:14:15 +00:00 committed by Sven Neumann
parent 981a36205a
commit f568dd4dd4
2 changed files with 30 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2005-02-21 Sven Neumann <sven@gimp.org>
* libgimpthumb/gimpthumb-utils.c (gimp_thumb_init): workaround for
bug #167973: if no valid home directory exists, use the folder for
temporary files to store thumbnails.
2005-02-21 Michael Natterer <mitch@gimp.org>
* app/actions/context-actions.c

View File

@ -106,9 +106,30 @@ gimp_thumb_init (const gchar *creator,
if (gimp_thumb_initialized)
gimp_thumb_exit ();
thumb_dir = (thumb_basedir ?
g_strdup (thumb_basedir) :
g_build_filename (g_get_home_dir(), ".thumbnails", NULL));
if (thumb_basedir)
{
thumb_dir = g_strdup (thumb_basedir);
}
else
{
const gchar *home_dir = g_get_home_dir ();
if (home_dir && g_file_test (home_dir, G_FILE_TEST_IS_DIR))
{
thumb_dir = g_build_filename (home_dir, ".thumbnails", NULL);
}
else
{
gchar *name = g_filename_display_name (g_get_tmp_dir ());
g_message (_("Cannot determine a valid home directory.\n"
"Thumbnails will be stored in the folder for "
"temporary files (%s) instead."), name);
g_free (name);
thumb_dir = g_build_filename (g_get_tmp_dir (), ".thumbnails", NULL);
}
}
enum_class = g_type_class_ref (GIMP_TYPE_THUMB_SIZE);