f6edd431b44b61e07b4cb8a0fe6718bb76a0827b
[platform/upstream/glib.git] / glib / gfileutils.h
1 /* gfileutils.h - File utility functions
2  *
3  *  Copyright 2000 Red Hat, Inc.
4  *
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.
9  *
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.
14  *
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.
19  */
20
21 #ifndef __GFILEUTILS_H__
22 #define __GFILEUTILS_H__
23
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28
29 #define G_FILE_ERROR g_file_error_quark ()
30
31 typedef enum
32 {
33   G_FILE_ERROR_EXIST,
34   G_FILE_ERROR_ISDIR,
35   G_FILE_ERROR_ACCES,
36   G_FILE_ERROR_NAMETOOLONG,
37   G_FILE_ERROR_NOENT,
38   G_FILE_ERROR_NOTDIR,
39   G_FILE_ERROR_NXIO,
40   G_FILE_ERROR_NODEV,
41   G_FILE_ERROR_ROFS,
42   G_FILE_ERROR_TXTBSY,
43   G_FILE_ERROR_FAULT,
44   G_FILE_ERROR_LOOP,
45   G_FILE_ERROR_NOSPC,
46   G_FILE_ERROR_NOMEM,
47   G_FILE_ERROR_MFILE,
48   G_FILE_ERROR_NFILE,
49   G_FILE_ERROR_BADF,
50   G_FILE_ERROR_INVAL,
51   G_FILE_ERROR_PIPE,
52   G_FILE_ERROR_AGAIN,
53   G_FILE_ERROR_INTR,
54   G_FILE_ERROR_IO,
55   G_FILE_ERROR_PERM,
56   G_FILE_ERROR_FAILED
57 } GFileError;
58
59 /* For backward-compat reasons, these are synced to an old 
60  * anonymous enum in libgnome. But don't use that enum
61  * in new code.
62  */
63 typedef enum
64 {
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,
70 } GFileTest;
71
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);
75
76 gboolean g_file_test         (const gchar  *filename,
77                               GFileTest     test);
78 gboolean g_file_get_contents (const gchar  *filename,
79                               gchar       **contents,
80                               guint        *length,
81                               GError      **error);
82
83
84
85 #ifdef __cplusplus
86 }
87 #endif
88
89 #endif /* __GFILEUTILS_H__ */
90
91