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 __G_FILEUTILS_H__ |
---|
22 | #define __G_FILEUTILS_H__ |
---|
23 | |
---|
24 | #include <glib/gerror.h> |
---|
25 | |
---|
26 | G_BEGIN_DECLS |
---|
27 | |
---|
28 | #define G_FILE_ERROR g_file_error_quark () |
---|
29 | |
---|
30 | typedef enum |
---|
31 | { |
---|
32 | G_FILE_ERROR_EXIST, |
---|
33 | G_FILE_ERROR_ISDIR, |
---|
34 | G_FILE_ERROR_ACCES, |
---|
35 | G_FILE_ERROR_NAMETOOLONG, |
---|
36 | G_FILE_ERROR_NOENT, |
---|
37 | G_FILE_ERROR_NOTDIR, |
---|
38 | G_FILE_ERROR_NXIO, |
---|
39 | G_FILE_ERROR_NODEV, |
---|
40 | G_FILE_ERROR_ROFS, |
---|
41 | G_FILE_ERROR_TXTBSY, |
---|
42 | G_FILE_ERROR_FAULT, |
---|
43 | G_FILE_ERROR_LOOP, |
---|
44 | G_FILE_ERROR_NOSPC, |
---|
45 | G_FILE_ERROR_NOMEM, |
---|
46 | G_FILE_ERROR_MFILE, |
---|
47 | G_FILE_ERROR_NFILE, |
---|
48 | G_FILE_ERROR_BADF, |
---|
49 | G_FILE_ERROR_INVAL, |
---|
50 | G_FILE_ERROR_PIPE, |
---|
51 | G_FILE_ERROR_AGAIN, |
---|
52 | G_FILE_ERROR_INTR, |
---|
53 | G_FILE_ERROR_IO, |
---|
54 | G_FILE_ERROR_PERM, |
---|
55 | G_FILE_ERROR_FAILED |
---|
56 | } GFileError; |
---|
57 | |
---|
58 | /* For backward-compat reasons, these are synced to an old |
---|
59 | * anonymous enum in libgnome. But don't use that enum |
---|
60 | * in new code. |
---|
61 | */ |
---|
62 | typedef enum |
---|
63 | { |
---|
64 | G_FILE_TEST_IS_REGULAR = 1 << 0, |
---|
65 | G_FILE_TEST_IS_SYMLINK = 1 << 1, |
---|
66 | G_FILE_TEST_IS_DIR = 1 << 2, |
---|
67 | G_FILE_TEST_IS_EXECUTABLE = 1 << 3, |
---|
68 | G_FILE_TEST_EXISTS = 1 << 4 |
---|
69 | } GFileTest; |
---|
70 | |
---|
71 | GQuark g_file_error_quark (void); |
---|
72 | /* So other code can generate a GFileError */ |
---|
73 | GFileError g_file_error_from_errno (gint err_no); |
---|
74 | |
---|
75 | gboolean g_file_test (const gchar *filename, |
---|
76 | GFileTest test); |
---|
77 | gboolean g_file_get_contents (const gchar *filename, |
---|
78 | gchar **contents, |
---|
79 | gsize *length, |
---|
80 | GError **error); |
---|
81 | gchar *g_file_read_link (const gchar *filename, |
---|
82 | GError **error); |
---|
83 | |
---|
84 | /* Wrapper / workalike for mkstemp() */ |
---|
85 | gint g_mkstemp (gchar *tmpl); |
---|
86 | |
---|
87 | /* Wrapper for g_mkstemp */ |
---|
88 | gint g_file_open_tmp (const gchar *tmpl, |
---|
89 | gchar **name_used, |
---|
90 | GError **error); |
---|
91 | |
---|
92 | gchar *g_build_path (const gchar *separator, |
---|
93 | const gchar *first_element, |
---|
94 | ...); |
---|
95 | gchar *g_build_filename (const gchar *first_element, |
---|
96 | ...); |
---|
97 | |
---|
98 | G_END_DECLS |
---|
99 | |
---|
100 | #endif /* __G_FILEUTILS_H__ */ |
---|
101 | |
---|
102 | |
---|