diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-09-01 21:29:34 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-09-01 21:29:34 +0000 |
commit | 6eaab4d00446c070c655f0e6c9a872532a776b6f (patch) | |
tree | 69610996dd0a6092459b14e164d4e48e03b1e5bb /apps/filetree.c | |
parent | 8e0a0babc57db3e9edc06f3e269fb47c27292ed5 (diff) | |
download | rockbox-6eaab4d00446c070c655f0e6c9a872532a776b6f.tar.gz rockbox-6eaab4d00446c070c655f0e6c9a872532a776b6f.zip |
Ged rid of uisimulator/common/io.c for android builds.
Use host's functions for file i/o directly (open(), close() ,etc.), not the sim_* variants.
Some dir functions need to be wrapped still because we need to cache the parents dir's path (host's dirent doesn't let us know).
For the same reason (incompatibility) with host's dirent) detach some members from Rockbox' dirent struct and put it into an extra one,
the values can be retrieved via the new dir_get_info().
Get rid of the sim_ prefix for sleep as well and change the signature to unix sleep().
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27968 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/filetree.c')
-rw-r--r-- | apps/filetree.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/apps/filetree.c b/apps/filetree.c index 0a1b49d1fe..1dc510f8c7 100644 --- a/apps/filetree.c +++ b/apps/filetree.c | |||
@@ -153,10 +153,10 @@ static void check_file_thumbnails(struct tree_context* c) | |||
153 | while((entry = readdir(dir)) != 0) /* walk directory */ | 153 | while((entry = readdir(dir)) != 0) /* walk directory */ |
154 | { | 154 | { |
155 | int ext_pos; | 155 | int ext_pos; |
156 | 156 | struct dirinfo info = dir_get_info(dir, entry); | |
157 | ext_pos = strlen((char *)entry->d_name) - strlen(file_thumbnail_ext); | 157 | ext_pos = strlen((char *)entry->d_name) - strlen(file_thumbnail_ext); |
158 | if (ext_pos <= 0 /* too short to carry ".talk" */ | 158 | if (ext_pos <= 0 /* too short to carry ".talk" */ |
159 | || (entry->attribute & ATTR_DIRECTORY) /* no file */ | 159 | || (info.attribute & ATTR_DIRECTORY) /* no file */ |
160 | || strcasecmp((char *)&entry->d_name[ext_pos], file_thumbnail_ext)) | 160 | || strcasecmp((char *)&entry->d_name[ext_pos], file_thumbnail_ext)) |
161 | { /* or doesn't end with ".talk", no candidate */ | 161 | { /* or doesn't end with ".talk", no candidate */ |
162 | continue; | 162 | continue; |
@@ -284,15 +284,17 @@ int ft_load(struct tree_context* c, const char* tempdir) | |||
284 | for ( i=0; i < global_settings.max_files_in_dir; i++ ) { | 284 | for ( i=0; i < global_settings.max_files_in_dir; i++ ) { |
285 | int len; | 285 | int len; |
286 | struct dirent *entry = readdir(dir); | 286 | struct dirent *entry = readdir(dir); |
287 | struct dirinfo info; | ||
287 | struct entry* dptr = | 288 | struct entry* dptr = |
288 | (struct entry*)(c->dircache + i * sizeof(struct entry)); | 289 | (struct entry*)(c->dircache + i * sizeof(struct entry)); |
289 | if (!entry) | 290 | if (!entry) |
290 | break; | 291 | break; |
291 | 292 | ||
293 | info = dir_get_info(dir, entry); | ||
292 | len = strlen((char *)entry->d_name); | 294 | len = strlen((char *)entry->d_name); |
293 | 295 | ||
294 | /* skip directories . and .. */ | 296 | /* skip directories . and .. */ |
295 | if ((entry->attribute & ATTR_DIRECTORY) && | 297 | if ((info.attribute & ATTR_DIRECTORY) && |
296 | (((len == 1) && (!strncmp((char *)entry->d_name, ".", 1))) || | 298 | (((len == 1) && (!strncmp((char *)entry->d_name, ".", 1))) || |
297 | ((len == 2) && (!strncmp((char *)entry->d_name, "..", 2))))) { | 299 | ((len == 2) && (!strncmp((char *)entry->d_name, "..", 2))))) { |
298 | i--; | 300 | i--; |
@@ -300,7 +302,7 @@ int ft_load(struct tree_context* c, const char* tempdir) | |||
300 | } | 302 | } |
301 | 303 | ||
302 | /* Skip FAT volume ID */ | 304 | /* Skip FAT volume ID */ |
303 | if (entry->attribute & ATTR_VOLUME_ID) { | 305 | if (info.attribute & ATTR_VOLUME_ID) { |
304 | i--; | 306 | i--; |
305 | continue; | 307 | continue; |
306 | } | 308 | } |
@@ -308,12 +310,12 @@ int ft_load(struct tree_context* c, const char* tempdir) | |||
308 | /* filter out dotfiles and hidden files */ | 310 | /* filter out dotfiles and hidden files */ |
309 | if (*c->dirfilter != SHOW_ALL && | 311 | if (*c->dirfilter != SHOW_ALL && |
310 | ((entry->d_name[0]=='.') || | 312 | ((entry->d_name[0]=='.') || |
311 | (entry->attribute & ATTR_HIDDEN))) { | 313 | (info.attribute & ATTR_HIDDEN))) { |
312 | i--; | 314 | i--; |
313 | continue; | 315 | continue; |
314 | } | 316 | } |
315 | 317 | ||
316 | dptr->attr = entry->attribute; | 318 | dptr->attr = info.attribute; |
317 | 319 | ||
318 | /* check for known file types */ | 320 | /* check for known file types */ |
319 | if ( !(dptr->attr & ATTR_DIRECTORY) ) | 321 | if ( !(dptr->attr & ATTR_DIRECTORY) ) |
@@ -362,8 +364,8 @@ int ft_load(struct tree_context* c, const char* tempdir) | |||
362 | } | 364 | } |
363 | dptr->name = &c->name_buffer[name_buffer_used]; | 365 | dptr->name = &c->name_buffer[name_buffer_used]; |
364 | dptr->time_write = | 366 | dptr->time_write = |
365 | (long)entry->wrtdate<<16 | | 367 | (long)info.wrtdate<<16 | |
366 | (long)entry->wrttime; /* in one # */ | 368 | (long)info.wrttime; /* in one # */ |
367 | strcpy(dptr->name, (char *)entry->d_name); | 369 | strcpy(dptr->name, (char *)entry->d_name); |
368 | name_buffer_used += len + 1; | 370 | name_buffer_used += len + 1; |
369 | 371 | ||