4
* Copyright (C) 2005 The GNOME Foundation
5
* Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
6
* Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
8
* This Program is free software; you can redistribute it and/or
9
* modify it under the terms of the GNU General Public License as
10
* published by the Free Software Foundation; either version 2 of
11
* the License, or (at your option) any later version.
13
* This Program is distributed in the hope that it will be useful,
14
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
* GNU General Public License for more details.
18
* You should have received a copy of the GNU General Public
19
* License along with this Library; see the file COPYING. If not,
20
* write to the Free Software Foundation, Inc., 59 Temple Place,
21
* Suite 330, Boston, MA 02111-1307, USA.
24
* Frederic Ruaudel <grumz@grumz.net>
25
* Rodrigo Moya <rodrigo@gnome-db.org>
26
* Pierre Wieser <pwieser@trychlos.org>
27
* ... and many others (see AUTHORS)
33
#include <glib/gi18n.h>
34
#include "nautilus-actions-tools-utils.h"
36
gboolean nautilus_actions_file_set_contents (const gchar* filename,
37
const gchar* contents,
41
gboolean success = FALSE;
44
success = g_file_set_contents (filename, contents, length, error);
48
if ((fp = fopen (filename, "wt")) != NULL)
50
if (fprintf (fp, contents) == length)
56
(*error) = g_error_new (G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Can't write data in file %s\n"), filename);
62
(*error) = g_error_new (G_FILE_ERROR, G_FILE_ERROR_FAILED, _("Can't open file %s for writing\n"), filename);