1 /* gfileutils.h - File utility functions
3 * Copyright 2000 Red Hat, Inc.
5 * GLib is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version.
10 * GLib is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with GLib; see the file COPYING.LIB. If not,
17 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #ifndef __G_FILEUTILS_H__
22 #define __G_FILEUTILS_H__
24 #include <glib/gerror.h>
28 #define G_FILE_ERROR g_file_error_quark ()
35 G_FILE_ERROR_NAMETOOLONG,
59 /* For backward-compat reasons, these are synced to an old
60 * anonymous enum in libgnome. But don't use that enum
65 G_FILE_TEST_IS_REGULAR = 1 << 0,
66 G_FILE_TEST_IS_SYMLINK = 1 << 1,
67 G_FILE_TEST_IS_DIR = 1 << 2,
68 G_FILE_TEST_IS_EXECUTABLE = 1 << 3,
69 G_FILE_TEST_EXISTS = 1 << 4
72 GQuark g_file_error_quark (void);
73 /* So other code can generate a GFileError */
74 GFileError g_file_error_from_errno (gint err_no);
77 #define g_file_test g_file_test_utf8
78 #define g_file_get_contents g_file_get_contents_utf8
79 #define g_mkstemp g_mkstemp_utf8
80 #define g_file_open_tmp g_file_open_tmp_utf8
83 gboolean g_file_test (const gchar *filename,
85 gboolean g_file_get_contents (const gchar *filename,
89 gboolean g_file_set_contents (const gchar *filename,
90 const gchar *contents,
93 gchar *g_file_read_link (const gchar *filename,
96 /* Wrapper / workalike for mkstemp() */
97 gint g_mkstemp (gchar *tmpl);
99 /* Wrapper for g_mkstemp */
100 gint g_file_open_tmp (const gchar *tmpl,
104 gchar *g_build_path (const gchar *separator,
105 const gchar *first_element,
106 ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
107 gchar *g_build_pathv (const gchar *separator,
108 gchar **args) G_GNUC_MALLOC;
110 gchar *g_build_filename (const gchar *first_element,
111 ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
112 gchar *g_build_filenamev (gchar **args) G_GNUC_MALLOC;
114 int g_mkdir_with_parents (const gchar *pathname,
119 #endif /* __G_FILEUTILS_H__ */