aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Kestner <mkestner@ximian.com>2003-03-15 01:19:25 +0800
committerMike Kestner <mkestner@src.gnome.org>2003-03-15 01:19:25 +0800
commit0b82cc7a34271a145a45ff7f296304e19a9315cc (patch)
tree47eae8ff4cff0dbe3a49a3742aca333ff71f6410
parent7bfabd86905e8b577b2d6492b516650be5075453 (diff)
downloadgsoc2013-evolution-0b82cc7a34271a145a45ff7f296304e19a9315cc.tar
gsoc2013-evolution-0b82cc7a34271a145a45ff7f296304e19a9315cc.tar.gz
gsoc2013-evolution-0b82cc7a34271a145a45ff7f296304e19a9315cc.tar.bz2
gsoc2013-evolution-0b82cc7a34271a145a45ff7f296304e19a9315cc.tar.lz
gsoc2013-evolution-0b82cc7a34271a145a45ff7f296304e19a9315cc.tar.xz
gsoc2013-evolution-0b82cc7a34271a145a45ff7f296304e19a9315cc.tar.zst
gsoc2013-evolution-0b82cc7a34271a145a45ff7f296304e19a9315cc.zip
use access() like camel
2003-03-14 Mike Kestner <mkestner@ximian.com> * gal/util/e-util.c (e_mkdir_hier): use access() like camel 2003-03-14 Mike Kestner <mkestner@ximian.com> * gal-view-collection.c (gal_view_collection_load): check failure on e_create_directory call and warn. * gal-view-instance.c (save_current_view): check for failure and warn. svn path=/trunk/; revision=20291
-rw-r--r--e-util/e-util.c7
-rw-r--r--widgets/menus/gal-view-collection.c7
-rw-r--r--widgets/menus/gal-view-instance.c4
3 files changed, 10 insertions, 8 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c
index 6c50331011..b830f654ee 100644
--- a/e-util/e-util.c
+++ b/e-util/e-util.c
@@ -275,11 +275,8 @@ e_mkdir_hier(const char *path, mode_t mode)
p = strchr (p + 1, '/');
if (p)
*p = '\0';
- if (mkdir (copy, mode) == -1) {
- switch (errno) {
- case EEXIST:
- break;
- default:
+ if (access (copy, F_OK) == -1) {
+ if (mkdir (copy, mode) == -1) {
g_free (copy);
return -1;
}
diff --git a/widgets/menus/gal-view-collection.c b/widgets/menus/gal-view-collection.c
index b7a571132e..87ac878b83 100644
--- a/widgets/menus/gal-view-collection.c
+++ b/widgets/menus/gal-view-collection.c
@@ -26,6 +26,7 @@
#include <util/e-i18n.h>
#include <ctype.h>
#include <string.h>
+#include <errno.h>
#include <libxml/parser.h>
#include <libgnome/gnome-util.h>
#include <gal/util/e-util.h>
@@ -469,7 +470,8 @@ gal_view_collection_load (GalViewCollection *collection)
g_return_if_fail (collection->system_dir != NULL);
g_return_if_fail (!collection->loaded);
- e_create_directory(collection->local_dir);
+ if ((e_create_directory(collection->local_dir) == -1) && (errno != EEXIST))
+ g_warning ("Unable to create dir %s: %s", collection->local_dir, g_strerror(errno));
load_single_dir(collection, collection->local_dir, TRUE);
load_single_dir(collection, collection->system_dir, FALSE);
@@ -537,7 +539,8 @@ gal_view_collection_save (GalViewCollection *collection)
e_xml_set_string_prop_by_name(child, "type", item->type);
}
filename = g_concat_dir_and_file(collection->local_dir, "galview.xml");
- e_xml_save_file (filename, doc);
+ if (e_xml_save_file (filename, doc) == -1)
+ g_warning ("Unable to save view to %s - %s", filename, g_strerror(errno));
xmlFreeDoc(doc);
g_free(filename);
}
diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c
index cda202f552..c26eadb5df 100644
--- a/widgets/menus/gal-view-instance.c
+++ b/widgets/menus/gal-view-instance.c
@@ -26,6 +26,7 @@
#include <util/e-i18n.h>
#include <ctype.h>
#include <string.h>
+#include <errno.h>
#include <libxml/parser.h>
#include <libgnome/gnome-util.h>
#include <gal/util/e-util.h>
@@ -92,7 +93,8 @@ save_current_view (GalViewInstance *instance)
if (instance->current_type)
e_xml_set_string_prop_by_name (root, "current_view_type", instance->current_type);
- e_xml_save_file (instance->current_view_filename, doc);
+ if (e_xml_save_file (instance->current_view_filename, doc) == -1)
+ g_warning ("Unable to save view to %s - %s", instance->current_view_filename, g_strerror(errno));
xmlFreeDoc(doc);
}