1 /* gfileutils.h - File utility functions
3 * Copyright 2000 Red Hat, Inc.
4 * Portions copyright (c) 2006 Nokia Corporation. All rights reserved.
6 * GLib is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * GLib is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with GLib; see the file COPYING.LIB. If not,
18 * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 #ifndef __G_FILEUTILS_H__
23 #define __G_FILEUTILS_H__
26 #include <glib/gerror.h>
30 #define G_FILE_ERROR g_file_error_quark ()
37 G_FILE_ERROR_NAMETOOLONG,
61 /* For backward-compat reasons, these are synced to an old
62 * anonymous enum in libgnome. But don't use that enum
67 G_FILE_TEST_IS_REGULAR = 1 << 0,
68 G_FILE_TEST_IS_SYMLINK = 1 << 1,
69 G_FILE_TEST_IS_DIR = 1 << 2,
70 G_FILE_TEST_IS_EXECUTABLE = 1 << 3,
71 G_FILE_TEST_EXISTS = 1 << 4
74 IMPORT_C GQuark g_file_error_quark (void);
75 /* So other code can generate a GFileError */
76 IMPORT_C GFileError g_file_error_from_errno (gint err_no);
79 #define g_file_test g_file_test_utf8
80 #define g_file_get_contents g_file_get_contents_utf8
81 #define g_mkstemp g_mkstemp_utf8
82 #define g_file_open_tmp g_file_open_tmp_utf8
85 IMPORT_C gboolean g_file_test (const gchar *filename,
87 IMPORT_C gboolean g_file_get_contents (const gchar *filename,
91 IMPORT_C gboolean g_file_set_contents (const gchar *filename,
92 const gchar *contents,
95 IMPORT_C gchar *g_file_read_link (const gchar *filename,
98 /* Wrapper / workalike for mkstemp() */
99 IMPORT_C gint g_mkstemp (gchar *tmpl);
101 /* Wrapper for g_mkstemp */
102 IMPORT_C gint g_file_open_tmp (const gchar *tmpl,
106 IMPORT_C gchar *g_build_path (const gchar *separator,
107 const gchar *first_element,
108 ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
109 IMPORT_C gchar *g_build_pathv (const gchar *separator,
110 gchar **args) G_GNUC_MALLOC;
112 IMPORT_C gchar *g_build_filename (const gchar *first_element,
113 ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
114 IMPORT_C gchar *g_build_filenamev (gchar **args) G_GNUC_MALLOC;
116 IMPORT_C int g_mkdir_with_parents (const gchar *pathname,
121 #endif /* __G_FILEUTILS_H__ */