diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-12-06 22:26:31 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-12-06 22:26:31 +0000 |
commit | 2c2416094f426972c9e2e96d25058311bbe82f97 (patch) | |
tree | 449b4e12e01c3c5c4afa2ae6a8cd396df82b5a38 /firmware/include | |
parent | c35b43b0f54bd607d38908544446caaa02f148a3 (diff) |
Get rid of get_user_file_path and do the path handling in wrappers for open() and friends.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28752 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/include')
-rw-r--r-- | firmware/include/dir.h | 7 | ||||
-rw-r--r-- | firmware/include/dir_uncached.h | 33 | ||||
-rw-r--r-- | firmware/include/file.h | 46 |
3 files changed, 59 insertions, 27 deletions
diff --git a/firmware/include/dir.h b/firmware/include/dir.h index 29dcb65961..3a582c3865 100644 --- a/firmware/include/dir.h +++ b/firmware/include/dir.h @@ -49,7 +49,6 @@ #define ATTR_ARCHIVE 0x20 #define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */ -#if (CONFIG_PLATFORM & (PLATFORM_NATIVE|PLATFORM_SDL)) #ifdef HAVE_DIRCACHE # include "dircache.h" # define DIR DIR_CACHED @@ -61,7 +60,7 @@ # define mkdir mkdir_cached # define rmdir rmdir_cached #else -#include "dir_uncached.h" +# include "dir_uncached.h" # define DIR DIR_UNCACHED # define dirent dirent_uncached # define opendir opendir_uncached @@ -71,9 +70,5 @@ # define mkdir mkdir_uncached # define rmdir rmdir_uncached #endif -#else -#include "dir-target.h" -#include "dir_uncached.h" -#endif #endif diff --git a/firmware/include/dir_uncached.h b/firmware/include/dir_uncached.h index 29512c7a69..3bae07177b 100644 --- a/firmware/include/dir_uncached.h +++ b/firmware/include/dir_uncached.h @@ -34,13 +34,13 @@ struct dirinfo { #include "file.h" #if (CONFIG_PLATFORM & PLATFORM_SDL) -#define dirent_uncached sim_dirent -#define DIR_UNCACHED SIM_DIR -#define opendir_uncached sim_opendir -#define readdir_uncached sim_readdir -#define closedir_uncached sim_closedir -#define mkdir_uncached sim_mkdir -#define rmdir_uncached sim_rmdir +# define dirent_uncached sim_dirent +# define DIR_UNCACHED SIM_DIR +# define opendir_uncached sim_opendir +# define readdir_uncached sim_readdir +# define closedir_uncached sim_closedir +# define mkdir_uncached sim_mkdir +# define rmdir_uncached sim_rmdir #endif #ifndef DIRENT_DEFINED @@ -54,6 +54,7 @@ struct dirent_uncached { #include "fat.h" +#ifndef DIR_DEFINED typedef struct { #if (CONFIG_PLATFORM & PLATFORM_NATIVE) bool busy; @@ -69,6 +70,24 @@ typedef struct { char *name; #endif } DIR_UNCACHED; +#endif + + +#if defined(APPLICATION) +#if (CONFIG_PLATFORM & PLATFORM_ANDROID) +#include "dir-target.h" +#endif +# undef opendir_uncached +# define opendir_uncached app_opendir +# undef mkdir_uncached +# define mkdir_uncached app_mkdir +# undef rmdir_uncached +# define rmdir_uncached app_rmdir +/* defined in rbpaths.c */ +extern DIR_UNCACHED* app_opendir(const char* name); +extern int app_rmdir(const char* name); +extern int app_mkdir(const char* name); +#endif #ifdef HAVE_HOTSWAP char *get_volume_name(int volume); diff --git a/firmware/include/file.h b/firmware/include/file.h index 8711124391..ee52c3f2b7 100644 --- a/firmware/include/file.h +++ b/firmware/include/file.h @@ -37,20 +37,38 @@ #define MAX_OPEN_FILES 11 #if !defined(PLUGIN) && !defined(CODEC) -#if (CONFIG_PLATFORM & PLATFORM_SDL) -#define open(x, ...) sim_open(x, __VA_ARGS__) -#define creat(x,m) sim_creat(x,m) -#define remove(x) sim_remove(x) -#define rename(x,y) sim_rename(x,y) -#define filesize(x) sim_filesize(x) -#define fsync(x) sim_fsync(x) -#define ftruncate(x,y) sim_ftruncate(x,y) -#define lseek(x,y,z) sim_lseek(x,y,z) -#define read(x,y,z) sim_read(x,y,z) -#define write(x,y,z) sim_write(x,y,z) -#define close(x) sim_close(x) -extern int sim_creat(const char *pathname, mode_t mode); -extern int sim_open(const char *pathname, int flags, ...); +#if defined(APPLICATION) +# define open(x, ...) app_open(x, __VA_ARGS__) +# define creat(x,m) app_creat(x, m) +# define remove(x) app_remove(x) +# define rename(x,y) app_rename(x,y) +extern int app_open(const char *name, int o, ...); +extern int app_creat(const char *name, mode_t mode); +extern int app_remove(const char* pathname); +extern int app_rename(const char* path, const char* newname); +# if (CONFIG_PLATFORM & PLATFORM_SDL) +# define filesize(x) sim_filesize(x) +# define fsync(x) sim_fsync(x) +# define ftruncate(x,y) sim_ftruncate(x,y) +# define lseek(x,y,z) sim_lseek(x,y,z) +# define read(x,y,z) sim_read(x,y,z) +# define write(x,y,z) sim_write(x,y,z) +# define close(x) sim_close(x) +# endif +#elif defined(SIMULATOR) +# define open(x, ...) sim_open(x, __VA_ARGS__) +# define creat(x,m) sim_creat(x,m) +# define remove(x) sim_remove(x) +# define rename(x,y) sim_rename(x,y) +# define filesize(x) sim_filesize(x) +# define fsync(x) sim_fsync(x) +# define ftruncate(x,y) sim_ftruncate(x,y) +# define lseek(x,y,z) sim_lseek(x,y,z) +# define read(x,y,z) sim_read(x,y,z) +# define write(x,y,z) sim_write(x,y,z) +# define close(x) sim_close(x) +extern int sim_open(const char *name, int o, ...); +extern int sim_creat(const char *name, mode_t mode); #endif typedef int (*open_func)(const char* pathname, int flags, ...); |