summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-12-06 22:26:31 +0000
committerThomas Martitz <kugel@rockbox.org>2010-12-06 22:26:31 +0000
commit2c2416094f426972c9e2e96d25058311bbe82f97 (patch)
tree449b4e12e01c3c5c4afa2ae6a8cd396df82b5a38 /firmware
parentc35b43b0f54bd607d38908544446caaa02f148a3 (diff)
downloadrockbox-2c2416094f426972c9e2e96d25058311bbe82f97.tar.gz
rockbox-2c2416094f426972c9e2e96d25058311bbe82f97.zip
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')
-rw-r--r--firmware/common/dircache.c11
-rw-r--r--firmware/common/rbpaths.c166
-rw-r--r--firmware/export/rbpaths.h35
-rw-r--r--firmware/font.c10
-rw-r--r--firmware/include/dir.h7
-rw-r--r--firmware/include/dir_uncached.h33
-rw-r--r--firmware/include/file.h46
-rw-r--r--firmware/load_code.c6
-rw-r--r--firmware/target/hosted/android/dir-target.h21
-rw-r--r--firmware/target/hosted/android/fs-android.c1
10 files changed, 230 insertions, 106 deletions
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index 509743bdbb..e8a5e7cbb1 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -89,13 +89,10 @@ static int fdbind_idx = 0;
89 */ 89 */
90static int open_dircache_file(unsigned flags, int permissions) 90static int open_dircache_file(unsigned flags, int permissions)
91{ 91{
92 char path[MAX_PATH];
93 const char *file = get_user_file_path(DIRCACHE_FILE, IS_FILE|NEED_WRITE,
94 path, sizeof(path));
95 if (permissions != 0) 92 if (permissions != 0)
96 return open(file, flags, permissions); 93 return open(DIRCACHE_FILE, flags, permissions);
97 94
98 return open(file, flags); 95 return open(DIRCACHE_FILE, flags);
99} 96}
100 97
101/** 98/**
@@ -103,9 +100,7 @@ static int open_dircache_file(unsigned flags, int permissions)
103 */ 100 */
104static int remove_dircache_file(void) 101static int remove_dircache_file(void)
105{ 102{
106 char path[MAX_PATH]; 103 return remove(DIRCACHE_FILE);
107 return remove(get_user_file_path(DIRCACHE_FILE, IS_FILE|NEED_WRITE,
108 path, sizeof(path)));
109} 104}
110#endif 105#endif
111/** 106/**
diff --git a/firmware/common/rbpaths.c b/firmware/common/rbpaths.c
index b63586c9f4..50d6ccf6ec 100644
--- a/firmware/common/rbpaths.c
+++ b/firmware/common/rbpaths.c
@@ -22,13 +22,47 @@
22 22
23#include <stdio.h> /* snprintf */ 23#include <stdio.h> /* snprintf */
24#include <stdlib.h> 24#include <stdlib.h>
25#include <stdarg.h>
25#include "rbpaths.h" 26#include "rbpaths.h"
26#include "file.h" /* MAX_PATH */ 27#include "file.h" /* MAX_PATH */
27#include "dir.h"
28#include "gcc_extensions.h" 28#include "gcc_extensions.h"
29#include "string-extra.h" 29#include "string-extra.h"
30#include "filefuncs.h" 30#include "filefuncs.h"
31 31
32#undef open
33#undef creat
34#undef remove
35#undef rename
36#undef opendir
37#undef mkdir
38#undef rmdir
39
40#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
41#include "dir-target.h"
42#define opendir opendir_android
43#define mkdir mkdir_android
44#define rmdir rmdir_android
45#elif (CONFIG_PLATFORM & PLATFORM_SDL)
46#define open sim_open
47#define remove sim_remove
48#define rename sim_rename
49#define opendir sim_opendir
50#define mkdir sim_mkdir
51#define rmdir sim_rmdir
52extern int sim_open(const char* name, int o, ...);
53extern int sim_remove(const char* name);
54extern int sim_rename(const char* old, const char* new);
55extern DIR* sim_opendir(const char* name);
56extern int sim_mkdir(const char* name);
57extern int sim_rmdir(const char* name);
58#endif
59
60/* flags for get_user_file_path() */
61/* whether you need write access to that file/dir, especially true
62 * for runtime generated files (config.cfg) */
63#define NEED_WRITE (1<<0)
64/* file or directory? */
65#define IS_FILE (1<<1)
32 66
33void paths_init(void) 67void paths_init(void)
34{ 68{
@@ -42,14 +76,28 @@ void paths_init(void)
42#endif 76#endif
43} 77}
44 78
45const char* get_user_file_path(const char *path, 79static bool try_path(const char* filename, unsigned flags)
46 unsigned flags, 80{
47 char* buf, 81 if (flags & IS_FILE)
48 const size_t bufsize) 82 {
83 if (file_exists(filename))
84 return true;
85 }
86 else
87 {
88 if (dir_exists(filename))
89 return true;
90 }
91 return false;
92}
93
94static const char* _get_user_file_path(const char *path,
95 unsigned flags,
96 char* buf,
97 const size_t bufsize)
49{ 98{
50 const char *ret = path; 99 const char *ret = path;
51 const char *pos = path; 100 const char *pos = path;
52 printf("%s(): looking for %s\n", __func__, path);
53 /* replace ROCKBOX_DIR in path with $HOME/.config/rockbox.org */ 101 /* replace ROCKBOX_DIR in path with $HOME/.config/rockbox.org */
54 pos += ROCKBOX_DIR_LEN; 102 pos += ROCKBOX_DIR_LEN;
55 if (*pos == '/') pos += 1; 103 if (*pos == '/') pos += 1;
@@ -66,27 +114,99 @@ const char* get_user_file_path(const char *path,
66 * write access is needed */ 114 * write access is needed */
67 if (flags & NEED_WRITE) 115 if (flags & NEED_WRITE)
68 ret = buf; 116 ret = buf;
69 else 117 else if (try_path(buf, flags))
118 ret = buf;
119
120 if (ret != buf) /* not found in $HOME, try ROCKBOX_BASE_DIR, !NEED_WRITE only */
70 { 121 {
71 if (flags & IS_FILE) 122 if (snprintf(buf, bufsize, ROCKBOX_SHARE_PATH "/%s", pos) >= (int)bufsize)
72 { 123 return NULL;
73 if (file_exists(buf)) 124
74 ret = buf; 125 if (try_path(buf, flags))
75 } 126 ret = buf;
76 else
77 {
78 if (dir_exists(buf))
79 ret = buf;
80 }
81 } 127 }
82 128
83 /* make a copy if we're about to return the path*/ 129 return ret;
84 if (UNLIKELY((flags & FORCE_BUFFER_COPY) && (ret != buf))) 130}
131
132int app_open(const char *name, int o, ...)
133{
134 char realpath[MAX_PATH];
135 va_list ap;
136 int fd;
137
138 if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
85 { 139 {
86 strlcpy(buf, ret, bufsize); 140 int flags = IS_FILE;
87 ret = buf; 141 if (o & (O_CREAT|O_RDWR|O_TRUNC|O_WRONLY))
142 flags |= NEED_WRITE;
143 name = _get_user_file_path(name, flags, realpath, sizeof(realpath));
88 } 144 }
145 va_start(ap, o);
146 fd = open(name, o, ap);
147 va_end(ap);
148
149 return fd;
150
151}
89 152
90 printf("%s(): %s\n", __func__, ret); 153int app_creat(const char* name, mode_t mode)
91 return ret; 154{
155 return app_open(name, O_CREAT|O_WRONLY|O_TRUNC, mode);
92} 156}
157
158int app_remove(const char *name)
159{
160 char realpath[MAX_PATH];
161 const char *fname = name;
162 if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
163 {
164 fname = _get_user_file_path(name, 0, realpath, sizeof(realpath));
165 }
166 return remove(fname);
167}
168
169int app_rename(const char *old, const char *new)
170{
171 char realpath[MAX_PATH];
172 const char *fname = old;
173 if (!strncmp(ROCKBOX_DIR, old, ROCKBOX_DIR_LEN))
174 {
175 fname = _get_user_file_path(old, 0, realpath, sizeof(realpath));
176 }
177 return rename(fname, new);
178}
179
180DIR *app_opendir(const char *name)
181{
182 char realpath[MAX_PATH];
183 const char *fname = name;
184 if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
185 {
186 fname = _get_user_file_path(name, 0, realpath, sizeof(realpath));
187 }
188 return opendir(fname);
189}
190
191int app_mkdir(const char* name)
192{
193 char realpath[MAX_PATH];
194 const char *fname = name;
195 if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
196 {
197 fname = _get_user_file_path(name, 0, realpath, sizeof(realpath));
198 }
199 return mkdir(fname);
200}
201
202int app_rmdir(const char* name)
203{
204 char realpath[MAX_PATH];
205 const char *fname = name;
206 if (!strncmp(ROCKBOX_DIR, name, ROCKBOX_DIR_LEN))
207 {
208 fname = _get_user_file_path(name, 0, realpath, sizeof(realpath));
209 }
210 return rmdir(fname);
211}
212
diff --git a/firmware/export/rbpaths.h b/firmware/export/rbpaths.h
index cd87888cef..6c5d769ed8 100644
--- a/firmware/export/rbpaths.h
+++ b/firmware/export/rbpaths.h
@@ -26,17 +26,6 @@
26#include "autoconf.h" 26#include "autoconf.h"
27#include "string-extra.h" 27#include "string-extra.h"
28 28
29/* flags for get_user_file_path() */
30/* whether you need write access to that file/dir, especially true
31 * for runtime generated files (config.cfg) */
32#define NEED_WRITE (1<<0)
33/* file or directory? */
34#define IS_FILE (1<<1)
35/* make sure the path is copied into the passed buffer (it may return
36 * the passed path directly otherwise, e.g. always on target builds) */
37#define FORCE_BUFFER_COPY (1<<2)
38
39
40 29
41/* name of directory where configuration, fonts and other data 30/* name of directory where configuration, fonts and other data
42 * files are stored */ 31 * files are stored */
@@ -67,35 +56,17 @@
67#define REC_BASE_DIR "/" 56#define REC_BASE_DIR "/"
68#define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists" 57#define PLAYLIST_CATALOG_DEFAULT_DIR "/Playlists"
69 58
70#ifndef PLUGIN
71static inline __attribute__((always_inline)) const char* get_user_file_path(const char *path,
72 unsigned flags,
73 char* buf,
74 const size_t bufsize)
75{
76 if (flags & FORCE_BUFFER_COPY)
77 {
78 strlcpy(buf, path, bufsize);
79 return buf;
80 }
81 return path;
82}
83#endif
84
85#define paths_init() 59#define paths_init()
86#else /* application */ 60#else /* application */
87 61
88#define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rockbox/rocks" 62#define PLUGIN_DIR ROCKBOX_LIBRARY_PATH "/rocks"
89#define CODECS_DIR ROCKBOX_LIBRARY_PATH "/rockbox/codecs" 63#define CODECS_DIR ROCKBOX_LIBRARY_PATH "/codecs"
90 64
91#define REC_BASE_DIR ROCKBOX_DIR "/" 65#define REC_BASE_DIR ROCKBOX_DIR "/"
92#define PLAYLIST_CATALOG_DEFAULT_DIR ROCKBOX_DIR "/Playlists" 66#define PLAYLIST_CATALOG_DEFAULT_DIR ROCKBOX_DIR "/Playlists"
93 67
94extern void paths_init(void); 68extern void paths_init(void);
95extern const char* get_user_file_path(const char *path, 69
96 unsigned flags,
97 char* buf,
98 const size_t bufsize);
99#endif /* APPLICATION */ 70#endif /* APPLICATION */
100 71
101#define LANG_DIR ROCKBOX_DIR "/langs" 72#define LANG_DIR ROCKBOX_DIR "/langs"
diff --git a/firmware/font.c b/firmware/font.c
index e973108bca..cd74459b1e 100644
--- a/firmware/font.c
+++ b/firmware/font.c
@@ -613,11 +613,7 @@ void glyph_cache_save(struct font* pf)
613 pf = &font_ui; 613 pf = &font_ui;
614 if (pf->fd >= 0 && pf == &font_ui) 614 if (pf->fd >= 0 && pf == &font_ui)
615 { 615 {
616 char path[MAX_PATH]; 616 cache_fd = open(GLYPH_CACHE_FILE, O_WRONLY|O_CREAT|O_TRUNC, 0666);
617 const char *file = get_user_file_path(GLYPH_CACHE_FILE, IS_FILE|NEED_WRITE,
618 path, sizeof(path));
619
620 cache_fd = open(file, O_WRONLY|O_CREAT|O_TRUNC, 0666);
621 if (cache_fd < 0) 617 if (cache_fd < 0)
622 return; 618 return;
623 619
@@ -678,7 +674,6 @@ static void glyph_cache_load(struct font* pf)
678 int i, size; 674 int i, size;
679 unsigned char tmp[2]; 675 unsigned char tmp[2];
680 unsigned short ch; 676 unsigned short ch;
681 char path[MAX_PATH];
682 unsigned short glyphs[MAX_SORT]; 677 unsigned short glyphs[MAX_SORT];
683 unsigned short glyphs_lru_order[MAX_SORT]; 678 unsigned short glyphs_lru_order[MAX_SORT];
684 int glyph_file_skip=0, glyph_file_size=0; 679 int glyph_file_skip=0, glyph_file_size=0;
@@ -687,8 +682,7 @@ static void glyph_cache_load(struct font* pf)
687 if ( sort_size > MAX_SORT ) 682 if ( sort_size > MAX_SORT )
688 sort_size = MAX_SORT; 683 sort_size = MAX_SORT;
689 684
690 fd = open(get_user_file_path(GLYPH_CACHE_FILE, IS_FILE|NEED_WRITE, 685 fd = open(GLYPH_CACHE_FILE, O_RDONLY|O_BINARY);
691 path, sizeof(path)), O_RDONLY|O_BINARY);
692 if (fd >= 0) { 686 if (fd >= 0) {
693 687
694 /* only read what fits */ 688 /* only read what fits */
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 @@
49#define ATTR_ARCHIVE 0x20 49#define ATTR_ARCHIVE 0x20
50#define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */ 50#define ATTR_VOLUME 0x40 /* this is a volume, not a real directory */
51 51
52#if (CONFIG_PLATFORM & (PLATFORM_NATIVE|PLATFORM_SDL))
53#ifdef HAVE_DIRCACHE 52#ifdef HAVE_DIRCACHE
54# include "dircache.h" 53# include "dircache.h"
55# define DIR DIR_CACHED 54# define DIR DIR_CACHED
@@ -61,7 +60,7 @@
61# define mkdir mkdir_cached 60# define mkdir mkdir_cached
62# define rmdir rmdir_cached 61# define rmdir rmdir_cached
63#else 62#else
64#include "dir_uncached.h" 63# include "dir_uncached.h"
65# define DIR DIR_UNCACHED 64# define DIR DIR_UNCACHED
66# define dirent dirent_uncached 65# define dirent dirent_uncached
67# define opendir opendir_uncached 66# define opendir opendir_uncached
@@ -71,9 +70,5 @@
71# define mkdir mkdir_uncached 70# define mkdir mkdir_uncached
72# define rmdir rmdir_uncached 71# define rmdir rmdir_uncached
73#endif 72#endif
74#else
75#include "dir-target.h"
76#include "dir_uncached.h"
77#endif
78 73
79#endif 74#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 {
34#include "file.h" 34#include "file.h"
35 35
36#if (CONFIG_PLATFORM & PLATFORM_SDL) 36#if (CONFIG_PLATFORM & PLATFORM_SDL)
37#define dirent_uncached sim_dirent 37# define dirent_uncached sim_dirent
38#define DIR_UNCACHED SIM_DIR 38# define DIR_UNCACHED SIM_DIR
39#define opendir_uncached sim_opendir 39# define opendir_uncached sim_opendir
40#define readdir_uncached sim_readdir 40# define readdir_uncached sim_readdir
41#define closedir_uncached sim_closedir 41# define closedir_uncached sim_closedir
42#define mkdir_uncached sim_mkdir 42# define mkdir_uncached sim_mkdir
43#define rmdir_uncached sim_rmdir 43# define rmdir_uncached sim_rmdir
44#endif 44#endif
45 45
46#ifndef DIRENT_DEFINED 46#ifndef DIRENT_DEFINED
@@ -54,6 +54,7 @@ struct dirent_uncached {
54 54
55#include "fat.h" 55#include "fat.h"
56 56
57#ifndef DIR_DEFINED
57typedef struct { 58typedef struct {
58#if (CONFIG_PLATFORM & PLATFORM_NATIVE) 59#if (CONFIG_PLATFORM & PLATFORM_NATIVE)
59 bool busy; 60 bool busy;
@@ -69,6 +70,24 @@ typedef struct {
69 char *name; 70 char *name;
70#endif 71#endif
71} DIR_UNCACHED; 72} DIR_UNCACHED;
73#endif
74
75
76#if defined(APPLICATION)
77#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
78#include "dir-target.h"
79#endif
80# undef opendir_uncached
81# define opendir_uncached app_opendir
82# undef mkdir_uncached
83# define mkdir_uncached app_mkdir
84# undef rmdir_uncached
85# define rmdir_uncached app_rmdir
86/* defined in rbpaths.c */
87extern DIR_UNCACHED* app_opendir(const char* name);
88extern int app_rmdir(const char* name);
89extern int app_mkdir(const char* name);
90#endif
72 91
73#ifdef HAVE_HOTSWAP 92#ifdef HAVE_HOTSWAP
74char *get_volume_name(int volume); 93char *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 @@
37#define MAX_OPEN_FILES 11 37#define MAX_OPEN_FILES 11
38 38
39#if !defined(PLUGIN) && !defined(CODEC) 39#if !defined(PLUGIN) && !defined(CODEC)
40#if (CONFIG_PLATFORM & PLATFORM_SDL) 40#if defined(APPLICATION)
41#define open(x, ...) sim_open(x, __VA_ARGS__) 41# define open(x, ...) app_open(x, __VA_ARGS__)
42#define creat(x,m) sim_creat(x,m) 42# define creat(x,m) app_creat(x, m)
43#define remove(x) sim_remove(x) 43# define remove(x) app_remove(x)
44#define rename(x,y) sim_rename(x,y) 44# define rename(x,y) app_rename(x,y)
45#define filesize(x) sim_filesize(x) 45extern int app_open(const char *name, int o, ...);
46#define fsync(x) sim_fsync(x) 46extern int app_creat(const char *name, mode_t mode);
47#define ftruncate(x,y) sim_ftruncate(x,y) 47extern int app_remove(const char* pathname);
48#define lseek(x,y,z) sim_lseek(x,y,z) 48extern int app_rename(const char* path, const char* newname);
49#define read(x,y,z) sim_read(x,y,z) 49# if (CONFIG_PLATFORM & PLATFORM_SDL)
50#define write(x,y,z) sim_write(x,y,z) 50# define filesize(x) sim_filesize(x)
51#define close(x) sim_close(x) 51# define fsync(x) sim_fsync(x)
52extern int sim_creat(const char *pathname, mode_t mode); 52# define ftruncate(x,y) sim_ftruncate(x,y)
53extern int sim_open(const char *pathname, int flags, ...); 53# define lseek(x,y,z) sim_lseek(x,y,z)
54# define read(x,y,z) sim_read(x,y,z)
55# define write(x,y,z) sim_write(x,y,z)
56# define close(x) sim_close(x)
57# endif
58#elif defined(SIMULATOR)
59# define open(x, ...) sim_open(x, __VA_ARGS__)
60# define creat(x,m) sim_creat(x,m)
61# define remove(x) sim_remove(x)
62# define rename(x,y) sim_rename(x,y)
63# define filesize(x) sim_filesize(x)
64# define fsync(x) sim_fsync(x)
65# define ftruncate(x,y) sim_ftruncate(x,y)
66# define lseek(x,y,z) sim_lseek(x,y,z)
67# define read(x,y,z) sim_read(x,y,z)
68# define write(x,y,z) sim_write(x,y,z)
69# define close(x) sim_close(x)
70extern int sim_open(const char *name, int o, ...);
71extern int sim_creat(const char *name, mode_t mode);
54#endif 72#endif
55 73
56typedef int (*open_func)(const char* pathname, int flags, ...); 74typedef int (*open_func)(const char* pathname, int flags, ...);
diff --git a/firmware/load_code.c b/firmware/load_code.c
index 5b5307e622..2337ee5cad 100644
--- a/firmware/load_code.c
+++ b/firmware/load_code.c
@@ -144,17 +144,15 @@ void *lc_open_from_mem(void *addr, size_t blob_size)
144 for (i = 0; i < 10; i++) 144 for (i = 0; i < 10; i++)
145 { 145 {
146#if (CONFIG_PLATFORM & PLATFORM_ANDROID) 146#if (CONFIG_PLATFORM & PLATFORM_ANDROID)
147 /* we need that path fixed, since get_user_file_path() 147 /* we need that path fixed, since _get_user_file_path()
148 * gives us the folder on the sdcard where we cannot load libraries 148 * gives us the folder on the sdcard where we cannot load libraries
149 * from (no exec permissions) 149 * from (no exec permissions)
150 */ 150 */
151 snprintf(temp_filename, sizeof(temp_filename), 151 snprintf(temp_filename, sizeof(temp_filename),
152 "/data/data/org.rockbox/app_rockbox/libtemp_binary_%d.so", i); 152 "/data/data/org.rockbox/app_rockbox/libtemp_binary_%d.so", i);
153#else 153#else
154 char name[MAX_PATH];
155 const char *_name = get_user_file_path(ROCKBOX_DIR, NEED_WRITE, name, sizeof(name));
156 snprintf(temp_filename, sizeof(temp_filename), 154 snprintf(temp_filename, sizeof(temp_filename),
157 "%s/libtemp_binary_%d.dll", _name, i); 155 ROCKBOX_DIR "/libtemp_binary_%d.dll", i);
158#endif 156#endif
159 fd = open(temp_filename, O_WRONLY|O_CREAT|O_TRUNC, 0700); 157 fd = open(temp_filename, O_WRONLY|O_CREAT|O_TRUNC, 0700);
160 if (fd >= 0) 158 if (fd >= 0)
diff --git a/firmware/target/hosted/android/dir-target.h b/firmware/target/hosted/android/dir-target.h
index c93d92caad..c6c6b4b2b0 100644
--- a/firmware/target/hosted/android/dir-target.h
+++ b/firmware/target/hosted/android/dir-target.h
@@ -24,10 +24,21 @@
24 24
25#include <dirent.h> 25#include <dirent.h>
26 26
27#define opendir _opendir 27#define dirent_uncached dirent
28#define mkdir _mkdir 28#define DIR_UNCACHED DIR
29#define closedir _closedir 29#define opendir_uncached _opendir
30#define readdir _readdir 30#define readdir_uncached _readdir
31#define closedir_uncached _closedir
32#define mkdir_uncached _mkdir
33#define rmdir_uncached rmdir
34
35#define dirent_android dirent
36#define DIR_android DIR
37#define opendir_android _opendir
38#define readdir_android _readdir
39#define closedir_android _closedir
40#define mkdir_android _mkdir
41#define rmdir_android rmdir
31 42
32extern DIR* _opendir(const char* name); 43extern DIR* _opendir(const char* name);
33extern int _mkdir(const char* name); 44extern int _mkdir(const char* name);
@@ -36,5 +47,7 @@ extern struct dirent *_readdir(DIR* dir);
36extern void fat_size(unsigned long *size, unsigned long *free); 47extern void fat_size(unsigned long *size, unsigned long *free);
37 48
38#define DIRFUNCTIONS_DEFINED 49#define DIRFUNCTIONS_DEFINED
50#define DIRENT_DEFINED
51#define DIR_DEFINED
39 52
40#endif /* __DIR_TARGET_H__ */ 53#endif /* __DIR_TARGET_H__ */
diff --git a/firmware/target/hosted/android/fs-android.c b/firmware/target/hosted/android/fs-android.c
index 5209458e54..1967198d3d 100644
--- a/firmware/target/hosted/android/fs-android.c
+++ b/firmware/target/hosted/android/fs-android.c
@@ -29,6 +29,7 @@
29#include "dir-target.h" 29#include "dir-target.h"
30#include "file.h" 30#include "file.h"
31#include "dir.h" 31#include "dir.h"
32#include "rbpaths.h"
32 33
33 34
34long filesize(int fd) 35long filesize(int fd)