medit/moo/mooutils/mooutils-fs.h

94 lines
3.3 KiB
C
Raw Normal View History

/*
* mooutils-fs.h
*
* Copyright (C) 2004-2006 by Yevgen Muntyan <muntyan@math.tamu.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* See COPYING file that comes with this distribution.
*/
#ifndef __MOO_UTILS_FS_H__
#define __MOO_UTILS_FS_H__
#include <glib.h>
2006-06-12 23:29:27 -07:00
/* MSVC */
2006-06-13 01:01:35 -07:00
#if defined(WIN32) && !defined(__GNUC__)
#include <sys/stat.h>
#ifndef S_ISREG
2006-06-12 23:29:27 -07:00
#define S_ISREG(m) (((m) & (_S_IFMT)) == (_S_IFREG))
#define S_ISDIR(m) (((m) & (_S_IFMT)) == (_S_IFDIR))
#endif
2006-06-13 01:01:35 -07:00
#endif
2006-06-12 23:29:27 -07:00
G_BEGIN_DECLS
#define MOO_FILE_ERROR (_moo_file_error_quark ())
2006-04-16 10:14:12 -07:00
typedef enum
{
MOO_FILE_ERROR_NONEXISTENT,
MOO_FILE_ERROR_NOT_FOLDER,
MOO_FILE_ERROR_BAD_FILENAME,
MOO_FILE_ERROR_FAILED,
MOO_FILE_ERROR_ALREADY_EXISTS,
MOO_FILE_ERROR_ACCESS_DENIED,
MOO_FILE_ERROR_READONLY,
MOO_FILE_ERROR_DIFFERENT_FS,
MOO_FILE_ERROR_NOT_IMPLEMENTED
} MooFileError;
GQuark _moo_file_error_quark (void) G_GNUC_CONST;
MooFileError _moo_file_error_from_errno (int err_code);
2006-04-16 10:14:12 -07:00
gboolean _moo_save_file_utf8 (const char *name,
const char *text,
gssize len,
GError **error);
2006-11-03 21:57:57 -08:00
gboolean _moo_remove_dir (const char *path,
2006-04-16 10:14:12 -07:00
gboolean recursive,
GError **error);
2006-11-03 21:57:57 -08:00
gboolean _moo_create_dir (const char *path,
2006-04-09 02:01:14 -07:00
GError **error);
2006-11-03 21:57:57 -08:00
gboolean _moo_rename_file (const char *path,
2006-08-23 01:09:17 -07:00
const char *new_path,
GError **error);
2006-04-16 10:14:12 -07:00
char **moo_filenames_from_locale (char **files);
2006-07-05 12:16:47 -07:00
char *moo_filename_from_locale (const char *file);
2006-03-16 12:01:15 -08:00
char *_moo_normalize_file_path (const char *filename);
2006-08-01 18:18:35 -07:00
/*
* C library and WinAPI functions wrappers analogous to glib/gstdio.h
*/
2006-11-03 21:57:57 -08:00
int _moo_unlink (const char *path);
int _moo_mkdir (const char *path); /* S_IRWXU on unix */
int _moo_rmdir (const char *path);
int _moo_remove (const char *path);
gpointer _moo_fopen (const char *path,
const char *mode);
2006-11-03 21:57:57 -08:00
int _moo_rename (const char *old_name,
const char *new_name);
2006-11-03 21:57:57 -08:00
int _moo_chdir (const char *path);
2006-11-12 11:12:46 -08:00
typedef struct _MooGlob MooGlob;
MooGlob *_moo_glob_new (const char *pattern);
gboolean _moo_glob_match (MooGlob *glob,
const char *filename);
gboolean _moo_glob_match_simple (const char *pattern,
const char *filename);
void _moo_glob_free (MooGlob *glob);
G_END_DECLS
#endif /* __MOO_UTILS_FS_H__ */