diff options
Diffstat (limited to 'e-util/e-util.c')
-rw-r--r-- | e-util/e-util.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/e-util/e-util.c b/e-util/e-util.c index 73a1842919..bfafdc8771 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -39,6 +39,7 @@ #include <glib/gstdio.h> #include <gtk/gtk.h> #include <libgnome/gnome-util.h> +#include <libgnomevfs/gnome-vfs.h> #ifdef G_OS_WIN32 #include <windows.h> @@ -239,6 +240,35 @@ e_write_file(const char *filename, const char *data, int flags) } gint +e_write_file_uri (const char *filename, const char *data) +{ + guint64 length = strlen(data); + guint64 bytes; + GnomeVFSResult result; + GnomeVFSHandle *handle = NULL; + + result = gnome_vfs_create (&handle, filename, GNOME_VFS_OPEN_WRITE, TRUE, 0755); + if (result != GNOME_VFS_OK) { + g_warning ("Couldn't save item"); + return 1; + } + + while (length > 0) { + gnome_vfs_write(handle, data, length, &bytes); + if (bytes > 0) { + length -= bytes; + data += bytes; + } else { + gnome_vfs_close(handle); + return 1; + } + } + + gnome_vfs_close (handle); + return 0; +} + +gint e_write_file_mkstemp(char *filename, const char *data) { int fd; |