| 1 |
/* |
| 2 |
gcommon |
| 3 |
copyright (c) 1998-2013 Kazuki Iwamoto http://www.maid.org/ iwm@maid.org |
| 4 |
|
| 5 |
This program is free software: you can redistribute it and/or modify |
| 6 |
it under the terms of the GNU General Public License as published by |
| 7 |
the Free Software Foundation, either version 3 of the License, or |
| 8 |
(at your option) any later version. |
| 9 |
|
| 10 |
This program 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 |
| 13 |
GNU General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public License |
| 16 |
along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
#ifndef __GLIBFILE_H__ |
| 19 |
#define __GLIBFILE_H__ |
| 20 |
|
| 21 |
|
| 22 |
#include "gcommon.h" |
| 23 |
|
| 24 |
|
| 25 |
G_BEGIN_DECLS |
| 26 |
|
| 27 |
|
| 28 |
/****************************************************************************** |
| 29 |
* File Utilities * |
| 30 |
******************************************************************************/ |
| 31 |
#if GLIB_CHECK_VERSION(2,6,0) |
| 32 |
# include <glib/gstdio.h> |
| 33 |
#endif /* GLIB_CHECK_VERSION(2,6,0) */ |
| 34 |
|
| 35 |
|
| 36 |
#ifdef USE_GTK_EMULATE |
| 37 |
typedef enum _GFileTest |
| 38 |
{ |
| 39 |
G_FILE_TEST_IS_REGULAR = 1 << 0, |
| 40 |
G_FILE_TEST_IS_SYMLINK = 1 << 1, |
| 41 |
G_FILE_TEST_IS_DIR = 1 << 2, |
| 42 |
G_FILE_TEST_IS_EXECUTABLE = 1 << 3, |
| 43 |
G_FILE_TEST_EXISTS = 1 << 4 |
| 44 |
} GFileTest; |
| 45 |
|
| 46 |
|
| 47 |
gboolean g_file_get_contents (const gchar *file, gchar **contents, gsize *length, GError **error); |
| 48 |
#endif /* USE_GTK_EMULATE */ |
| 49 |
#if ! GLIB_CHECK_VERSION(2,8,0) |
| 50 |
gboolean g_file_set_contents (const gchar *file, const gchar *contents, gssize length, GError **error); |
| 51 |
#endif /* not GLIB_CHECK_VERSION(2,8,0) */ |
| 52 |
#ifdef USE_GTK_EMULATE |
| 53 |
gboolean g_file_test (const gchar *file, GFileTest test); |
| 54 |
#endif /* USE_GTK_EMULATE */ |
| 55 |
#if ! GLIB_CHECK_VERSION(2,26,0) |
| 56 |
typedef struct stat GStatBuf; |
| 57 |
#endif /* not GLIB_CHECK_VERSION(2,26,0) */ |
| 58 |
|
| 59 |
|
| 60 |
#if ! GLIB_CHECK_VERSION(2,26,0) |
| 61 |
gchar *g_mkdtemp (gchar *tmpl); |
| 62 |
gchar *g_mkdtemp_full (gchar *tmpl, gint mode); |
| 63 |
#endif /* not GLIB_CHECK_VERSION(2,26,0) */ |
| 64 |
#if ! GLIB_CHECK_VERSION(2,30,0) |
| 65 |
gchar *g_dir_make_tmp (const gchar *tmpl, GError **error); |
| 66 |
#endif /* not GLIB_CHECK_VERSION(2,30,0) */ |
| 67 |
#if ! GLIB_CHECK_VERSION(2,22,0) |
| 68 |
# define g_mapped_file_unref(file) g_mapped_file_free(file) |
| 69 |
#endif /* not GLIB_CHECK_VERSION(2,22,0) */ |
| 70 |
#if ! GLIB_CHECK_VERSION(2,6,0) |
| 71 |
# define g_open open |
| 72 |
# define g_rename rename |
| 73 |
# ifdef G_OS_WIN32 |
| 74 |
gint g_mkdir (const gchar *filename, gint mode); |
| 75 |
# else /* not G_OS_WIN32 */ |
| 76 |
# define g_mkdir mkdir |
| 77 |
# endif /* not G_OS_WIN32 */ |
| 78 |
# define g_stat stat |
| 79 |
# ifdef HAVE_LSTAT |
| 80 |
# define g_lstat lstat |
| 81 |
# else /* not HAVE_LSTAT */ |
| 82 |
# define g_lstat stat |
| 83 |
# endif /* not HAVE_LSTAT */ |
| 84 |
# define g_unlink unlink |
| 85 |
# define g_remove remove |
| 86 |
# define g_rmdir rmdir |
| 87 |
# define g_fopen fopen |
| 88 |
# define g_freopen freopen |
| 89 |
#endif /* not GLIB_CHECK_VERSION(2,6,0) */ |
| 90 |
#if ! GLIB_CHECK_VERSION(2,8,0) |
| 91 |
# ifdef G_OS_WIN32 |
| 92 |
gint g_chmod (const gchar *filename, gint mode); |
| 93 |
gint g_access (const gchar *filename, gint mode); |
| 94 |
gint g_creat (const gchar *filename, gint mode); |
| 95 |
gint g_chdir (const gchar *path); |
| 96 |
# else /* not G_OS_WIN32 */ |
| 97 |
# define g_chmod chmod |
| 98 |
# define g_access access |
| 99 |
# define g_creat creat |
| 100 |
# define g_chdir chdir |
| 101 |
# endif /* not G_OS_WIN32 */ |
| 102 |
#endif /* not GLIB_CHECK_VERSION(2,8,0) */ |
| 103 |
#if ! GLIB_CHECK_VERSION(2,18,0) |
| 104 |
# ifdef G_OS_WIN32 |
| 105 |
# include <sys/utime.h> |
| 106 |
# endif /* G_OS_WIN32 */ |
| 107 |
gint g_utime (const gchar *filename, struct utimbuf *utb); |
| 108 |
#endif /* not GLIB_CHECK_VERSION(2,18,0) */ |
| 109 |
|
| 110 |
|
| 111 |
G_END_DECLS |
| 112 |
|
| 113 |
|
| 114 |
#endif /* __GLIBFILE_H__ */ |