summaryrefslogtreecommitdiff
path: root/firmware/target/hosted/filesystem-app.h
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/hosted/filesystem-app.h')
-rw-r--r--firmware/target/hosted/filesystem-app.h117
1 files changed, 117 insertions, 0 deletions
diff --git a/firmware/target/hosted/filesystem-app.h b/firmware/target/hosted/filesystem-app.h
new file mode 100644
index 0000000000..68b3f13b6e
--- /dev/null
+++ b/firmware/target/hosted/filesystem-app.h
@@ -0,0 +1,117 @@
1/***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
9 *
10 * Copyright (C) 2014 by Michael Sevakis
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
16 *
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
19 *
20 ****************************************************************************/
21
22#ifndef _FILESYSTEM_APP_H_
23#define _FILESYSTEM_APP_H_
24
25#if defined(PLUGIN) || defined(CODEC)
26/* Prevent often-problematic plugin namespace pollution */
27#define FILEFUNCTIONS_DECLARED
28#define FILEFUNCTIONS_DEFINED
29#define DIRFUNCTIONS_DECLARED
30#define DIRFUNCTIONS_DEFINED
31#define OSFUNCTIONS_DECLARED
32#endif /* PLUGIN || CODEC */
33
34/* flags for get_user_file_path() */
35/* whether you need write access to that file/dir, especially true
36 * for runtime generated files (config.cfg) */
37#define NEED_WRITE (1<<0)
38/* file or directory? */
39#define IS_FILE (1<<1)
40
41#ifndef OSFUNCTIONS_DECLARED
42#define FS_PREFIX(_x_) app_ ## _x_
43
44void paths_init(void);
45const char * handle_special_dirs(const char *dir, unsigned flags,
46 char *buf, const size_t bufsize);
47
48#endif /* !OSFUNCTIONS_DECLARED */
49#endif /* _FILESYSTEM_APP_H_ */
50
51#ifdef HAVE_SDL
52#include "filesystem-sdl.h"
53#endif /* HAVE_SDL */
54#ifdef WIN32
55#include "filesystem-win32.h"
56#else /* !WIN32 */
57#include "filesystem-unix.h"
58#endif /* WIN32 */
59#include "filesystem-hosted.h"
60
61#ifdef _FILE_H_
62#ifndef _FILESYSTEM_APP__FILE_H_
63#define _FILESYSTEM_APP__FILE_H_
64
65#ifdef RB_FILESYSTEM_OS
66#define FILEFUNCTIONS_DEFINED
67#endif
68
69#ifndef FILEFUNCTIONS_DECLARED
70int app_open(const char *name, int oflag, ...);
71int app_creat(const char *name, mode_t mode);
72#define app_close os_close
73#define app_ftruncate os_ftruncate
74#define app_fsync os_fsync
75#define app_lseek os_lseek
76#ifdef HAVE_SDL_THREADS
77ssize_t app_read(int fildes, void *buf, size_t nbyte);
78ssize_t app_write(int fildes, const void *buf, size_t nbyte);
79#else
80#define app_read os_read
81#define app_write os_write
82#endif /* HAVE_SDL_THREADS */
83int app_remove(const char *path);
84int app_rename(const char *old, const char *new);
85#define app_filesize os_filesize
86#define app_fsamefile os_fsamefile
87int app_relate(const char *path1, const char *path2);
88bool app_file_exists(const char *path);
89ssize_t app_readlink(const char *path, char *buf, size_t bufsize);
90#endif /* !FILEFUNCTIONS_DECLARED */
91
92#endif /* _FILESYSTEM_APP__FILE_H_ */
93#endif /* _FILE_H_ */
94
95#ifdef _DIR_H_
96#ifndef _FILESYSTEM_APP__DIR_H_
97#define _FILESYSTEM_APP__DIR_H_
98
99#ifdef RB_FILESYSTEM_OS
100#define DIRFUNCTIONS_DEFINED
101#endif
102
103#define DIRENT dirent
104#define DIRENT_DEFINED
105
106#ifndef DIRFUNCTIONS_DECLARED
107DIR * app_opendir(const char *dirname);
108struct dirent * app_readdir(DIR *dirp);
109int app_closedir(DIR *dirp);
110int app_mkdir(const char *path);
111int app_rmdir(const char *path);
112int app_samedir(DIR *dirp1, DIR *dirp2);
113bool app_dir_exists(const char *dirname);
114#endif /* DIRFUNCTIONS_DECLARED */
115
116#endif /* _FILESYSTEM_APP__DIR_H_ */
117#endif /* _DIR_H_ */