file.h 1.85 KB
Newer Older
1 2
/*
 * This file is part of libbluray
3
 * Copyright (C) 2009-2010  Obliter0n
4 5
 * Copyright (C) 2009-2010  John Stebbins
 *
gates's avatar
gates committed
6 7 8 9
 * This library 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.
10
 *
gates's avatar
gates committed
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
gates's avatar
gates committed
13 14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
15
 *
gates's avatar
gates committed
16 17 18
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see
 * <http://www.gnu.org/licenses/>.
19
 */
cRTrn13's avatar
cRTrn13 committed
20 21 22 23

#ifndef FILE_H_
#define FILE_H_

24 25
#include "filesystem.h"

hpi1's avatar
hpi1 committed
26
#include "util/attributes.h"
27

hpi1's avatar
hpi1 committed
28 29 30 31 32 33 34
#ifdef _WIN32
# define DIR_SEP "\\"
# define DIR_SEP_CHAR '\\'
#else
# define DIR_SEP "/"
# define DIR_SEP_CHAR '/'
#endif
cRTrn13's avatar
cRTrn13 committed
35

hpi1's avatar
hpi1 committed
36 37 38 39
/*
 * file access
 */

cRTrn13's avatar
cRTrn13 committed
40
#define file_close(X) X->close(X)
cRTrn13's avatar
cRTrn13 committed
41 42
#define file_seek(X,Y,Z) X->seek(X,Y,Z)
#define file_tell(X) X->tell(X)
hpi1's avatar
hpi1 committed
43
//#define file_eof(X) X->eof(X)
44
#define file_read(X,Y,Z) (size_t)X->read(X,Y,Z)
hpi1's avatar
hpi1 committed
45
//#define file_write(X,Y,Z) (size_t)X->write(X,Y,Z)
hpi1's avatar
hpi1 committed
46
BD_PRIVATE int64_t file_size(BD_FILE_H *fp);
cRTrn13's avatar
cRTrn13 committed
47

48
BD_PRIVATE extern BD_FILE_H* (*file_open)(const char* filename, const char *mode);
cRTrn13's avatar
cRTrn13 committed
49

50 51
BD_PRIVATE BD_FILE_OPEN file_open_default(void);

hpi1's avatar
hpi1 committed
52

hpi1's avatar
hpi1 committed
53 54 55 56 57 58 59
/*
 * directory access
 */

#define dir_close(X) X->close(X)
#define dir_read(X,Y) X->read(X,Y)

60
BD_PRIVATE extern BD_DIR_H* (*dir_open)(const char* dirname);
hpi1's avatar
hpi1 committed
61

hpi1's avatar
hpi1 committed
62 63
BD_PRIVATE BD_DIR_OPEN dir_open_default(void);

64 65 66 67 68
/*
 * local filesystem
 */

BD_PRIVATE int file_unlink(const char *file);
hpi1's avatar
hpi1 committed
69 70 71
BD_PRIVATE int file_path_exists(const char *path);
BD_PRIVATE int file_mkdir(const char *dir);
BD_PRIVATE int file_mkdirs(const char *path);
72

cRTrn13's avatar
cRTrn13 committed
73
#endif /* FILE_H_ */