00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __G_FILEUTILS_H__
00023 #define __G_FILEUTILS_H__
00024
00025 #include <_ansi.h>
00026 #include <glib/gerror.h>
00027
00028 G_BEGIN_DECLS
00029
00030 #define G_FILE_ERROR g_file_error_quark ()
00031
00032 typedef enum
00033 {
00034 G_FILE_ERROR_EXIST,
00035 G_FILE_ERROR_ISDIR,
00036 G_FILE_ERROR_ACCES,
00037 G_FILE_ERROR_NAMETOOLONG,
00038 G_FILE_ERROR_NOENT,
00039 G_FILE_ERROR_NOTDIR,
00040 G_FILE_ERROR_NXIO,
00041 G_FILE_ERROR_NODEV,
00042 G_FILE_ERROR_ROFS,
00043 G_FILE_ERROR_TXTBSY,
00044 G_FILE_ERROR_FAULT,
00045 G_FILE_ERROR_LOOP,
00046 G_FILE_ERROR_NOSPC,
00047 G_FILE_ERROR_NOMEM,
00048 G_FILE_ERROR_MFILE,
00049 G_FILE_ERROR_NFILE,
00050 G_FILE_ERROR_BADF,
00051 G_FILE_ERROR_INVAL,
00052 G_FILE_ERROR_PIPE,
00053 G_FILE_ERROR_AGAIN,
00054 G_FILE_ERROR_INTR,
00055 G_FILE_ERROR_IO,
00056 G_FILE_ERROR_PERM,
00057 G_FILE_ERROR_NOSYS,
00058 G_FILE_ERROR_FAILED
00059 } GFileError;
00060
00061
00062
00063
00064
00065 typedef enum
00066 {
00067 G_FILE_TEST_IS_REGULAR = 1 << 0,
00068 G_FILE_TEST_IS_SYMLINK = 1 << 1,
00069 G_FILE_TEST_IS_DIR = 1 << 2,
00070 G_FILE_TEST_IS_EXECUTABLE = 1 << 3,
00071 G_FILE_TEST_EXISTS = 1 << 4
00072 } GFileTest;
00073
00074 IMPORT_C GQuark g_file_error_quark (void);
00075
00076 IMPORT_C GFileError g_file_error_from_errno (gint err_no);
00077
00078 #ifdef G_OS_WIN32
00079 #define g_file_test g_file_test_utf8
00080 #define g_file_get_contents g_file_get_contents_utf8
00081 #define g_mkstemp g_mkstemp_utf8
00082 #define g_file_open_tmp g_file_open_tmp_utf8
00083 #endif
00084
00085 IMPORT_C gboolean g_file_test (const gchar *filename,
00086 GFileTest test);
00087 IMPORT_C gboolean g_file_get_contents (const gchar *filename,
00088 gchar **contents,
00089 gsize *length,
00090 GError **error);
00091 IMPORT_C gboolean g_file_set_contents (const gchar *filename,
00092 const gchar *contents,
00093 gssize length,
00094 GError **error);
00095 IMPORT_C gchar *g_file_read_link (const gchar *filename,
00096 GError **error);
00097
00098
00099 IMPORT_C gint g_mkstemp (gchar *tmpl);
00100
00101
00102 IMPORT_C gint g_file_open_tmp (const gchar *tmpl,
00103 gchar **name_used,
00104 GError **error);
00105
00106 IMPORT_C gchar *g_build_path (const gchar *separator,
00107 const gchar *first_element,
00108 ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
00109 IMPORT_C gchar *g_build_pathv (const gchar *separator,
00110 gchar **args) G_GNUC_MALLOC;
00111
00112 IMPORT_C gchar *g_build_filename (const gchar *first_element,
00113 ...) G_GNUC_MALLOC G_GNUC_NULL_TERMINATED;
00114 IMPORT_C gchar *g_build_filenamev (gchar **args) G_GNUC_MALLOC;
00115
00116 IMPORT_C int g_mkdir_with_parents (const gchar *pathname,
00117 int mode);
00118
00119 G_END_DECLS
00120
00121 #endif