Revision: 1740
http://geeqie.svn.sourceforge.net/geeqie/?rev=1740&view=rev
Author: nadvornik
Date: 2009-06-10 20:45:24 +0000 (Wed, 10 Jun 2009)
Log Message:
-----------
make sure that a directory exists on saving desktop files
Modified Paths:
--------------
trunk/src/desktop_file.c
Modified: trunk/src/desktop_file.c
===================================================================
--- trunk/src/desktop_file.c 2009-06-10 20:26:47 UTC (rev 1739)
+++ trunk/src/desktop_file.c 2009-06-10 20:45:24 UTC (rev 1740)
@@ -59,6 +59,7 @@
static gboolean editor_window_save(EditorWindow *ew)
{
+ gchar *dir;
gchar *path;
gchar *text;
GtkTextIter start, end;
@@ -75,16 +76,24 @@
gtk_text_buffer_get_bounds(ew->buffer, &start, &end);
text = gtk_text_buffer_get_text(ew->buffer, &start, &end, FALSE);
- path = g_build_filename(get_rc_dir(), "applications", name, NULL);
+ dir = g_build_filename(get_rc_dir(), "applications", NULL);
+ path = g_build_filename(dir, name, NULL);
- if (!g_file_set_contents(path, text, -1, &error))
+ if (!recursive_mkdir_if_not_exists(dir, 0755))
{
+ file_util_warning_dialog(_("Can't save"), _("Could not create
directory"), GTK_STOCK_DIALOG_ERROR, NULL);
+ ret = FALSE;
+ }
+
+ if (ret && !g_file_set_contents(path, text, -1, &error))
+ {
file_util_warning_dialog(_("Can't save"), error->message,
GTK_STOCK_DIALOG_ERROR, NULL);
g_error_free(error);
ret = FALSE;
}
g_free(path);
+ g_free(dir);
g_free(text);
layout_editors_reload_all();
return ret;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn