medit/moo/mooutils/mooutils-fs.h

109 lines
3.8 KiB
C
Raw Normal View History

/*
* mooutils-fs.h
*
2010-12-21 20:15:45 -08:00
* Copyright (C) 2004-2010 by Yevgen Muntyan <emuntyan@users.sourceforge.net>
*
* This file is part of medit. medit is free software; you can
* redistribute it and/or modify it under the terms of the
* GNU Lesser General Public License as published by the
* Free Software Foundation; either version 2.1 of the License,
* or (at your option) any later version.
*
* You should have received a copy of the GNU Lesser General Public
* License along with medit. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef MOO_UTILS_FS_H
#define MOO_UTILS_FS_H
#include <glib.h>
#include <gtk/gtk.h>
2006-06-13 01:29:27 -05:00
/* MSVC */
2013-04-20 22:14:56 -07:00
#if defined(_WIN32) && !defined(__GNUC__)
2006-06-13 03:01:35 -05:00
#include <sys/stat.h>
2013-04-20 22:14:56 -07:00
#include <fcntl.h>
2006-06-13 03:01:35 -05:00
#ifndef S_ISREG
2006-06-13 01:29:27 -05:00
#define S_ISREG(m) (((m) & (_S_IFMT)) == (_S_IFREG))
#define S_ISDIR(m) (((m) & (_S_IFMT)) == (_S_IFDIR))
#endif
2006-06-13 03:01:35 -05:00
#endif
2006-06-13 01:29:27 -05:00
2008-05-21 15:37:44 -05:00
#ifndef O_BINARY
#define O_BINARY 0x0
#endif
G_BEGIN_DECLS
#define MOO_FILE_ERROR (_moo_file_error_quark ())
2006-04-16 12:14:12 -05:00
/* XXX */
#define _moo_save_file_utf8 moo_save_file_utf8
#define _moo_unlink moo_unlink
2006-04-16 12:14:12 -05: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 12:14:12 -05:00
gboolean _moo_save_file_utf8 (const char *name,
const char *text,
gssize len,
GError **error);
2006-11-03 23:57:57 -06:00
gboolean _moo_remove_dir (const char *path,
2006-04-16 12:14:12 -05:00
gboolean recursive,
GError **error);
2006-11-03 23:57:57 -06:00
gboolean _moo_create_dir (const char *path,
2006-04-09 04:01:14 -05:00
GError **error);
int _moo_mkdir_with_parents (const char *path); /* S_IRWXU on unix */
2006-11-03 23:57:57 -06:00
gboolean _moo_rename_file (const char *path,
2006-08-23 03:09:17 -05:00
const char *new_path,
GError **error);
2009-11-01 12:44:46 -08:00
char **moo_filenames_from_locale (char **files);
char *moo_filename_from_locale (const char *file);
char *_moo_filename_to_uri (const char *file,
2008-05-21 15:37:44 -05:00
GError **error);
2006-03-16 14:01:15 -06:00
char *_moo_normalize_file_path (const char *filename);
2008-01-27 00:07:18 -06:00
gboolean _moo_path_is_absolute (const char *path);
2006-08-01 20:18:35 -05:00
2009-11-01 12:44:46 -08:00
gboolean _moo_copy_files_ui (GList *filenames,
const char *destdir,
GtkWidget *parent);
gboolean _moo_move_files_ui (GList *filenames,
const char *destdir,
GtkWidget *parent);
/*
* C library and WinAPI functions wrappers analogous to glib/gstdio.h
*/
2006-11-03 23:57:57 -06:00
int _moo_unlink (const char *path);
int _moo_mkdir (const char *path); /* S_IRWXU on unix */
int _moo_remove (const char *path);
gpointer _moo_fopen (const char *path,
const char *mode);
2006-11-03 23:57:57 -06:00
int _moo_rename (const char *old_name,
const char *new_name);
2006-11-12 13:12:46 -06:00
gboolean _moo_glob_match_simple (const char *pattern,
const char *filename);
G_END_DECLS
#endif /* MOO_UTILS_FS_H */