diff options
| author | Kevin Ferrare <kevin@rockbox.org> | 2007-07-20 17:06:55 +0000 |
|---|---|---|
| committer | Kevin Ferrare <kevin@rockbox.org> | 2007-07-20 17:06:55 +0000 |
| commit | 011a325e32c05f6e4817dcdc555615e6b7b6c102 (patch) | |
| tree | ab22ab91b99524dba823cda861b17520db030911 /apps/plugins/properties.c | |
| parent | 930278bcc0fd944ec50f30074b53b4c7cf0e3ccf (diff) | |
| download | rockbox-011a325e32c05f6e4817dcdc555615e6b7b6c102.zip rockbox-011a325e32c05f6e4817dcdc555615e6b7b6c102.tar.gz rockbox-011a325e32c05f6e4817dcdc555615e6b7b6c102.tar.bz2 rockbox-011a325e32c05f6e4817dcdc555615e6b7b6c102.tar.xz | |
Makes apps and plugins interract with directories using a posix-like api instead of calling dircache / simulator functions (no additionnal layer added, only a cosmetic change)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13943 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/properties.c')
| -rw-r--r-- | apps/plugins/properties.c | 53 |
1 files changed, 1 insertions, 52 deletions
diff --git a/apps/plugins/properties.c b/apps/plugins/properties.c index 3b4f279..86817e2 100644 --- a/apps/plugins/properties.c +++ b/apps/plugins/properties.c @@ -59,30 +59,18 @@ static bool file_properties(char* selected_file) { bool found = false; char tstr[MAX_PATH]; -#ifdef HAVE_DIRCACHE - DIRCACHED* dir; - struct dircache_entry* entry; -#else DIR* dir; struct dirent* entry; -#endif + char* ptr = rb->strrchr(selected_file, '/') + 1; int dirlen = (ptr - selected_file); rb->strncpy(tstr, selected_file, dirlen); tstr[dirlen] = 0; -#ifdef HAVE_DIRCACHE - dir = rb->opendir_cached(tstr); -#else dir = rb->opendir(tstr); -#endif if (dir) { -#ifdef HAVE_DIRCACHE - while(0 != (entry = rb->readdir_cached(dir))) -#else while(0 != (entry = rb->readdir(dir))) -#endif { if(!rb->strcmp(entry->d_name, selected_file+dirlen)) { @@ -103,11 +91,7 @@ static bool file_properties(char* selected_file) break; } } -#ifdef HAVE_DIRCACHE - rb->closedir_cached(dir); -#else rb->closedir(dir); -#endif } return found; } @@ -128,30 +112,17 @@ static bool _dir_properties(DPS* dps) and informs the user of the progress */ bool result; int dirlen; -#ifdef HAVE_DIRCACHE - DIRCACHED* dir; - struct dircache_entry* entry; -#else DIR* dir; struct dirent* entry; -#endif result = true; dirlen = rb->strlen(dps->dirname); -#ifdef HAVE_DIRCACHE - dir = rb->opendir_cached(dps->dirname); -#else dir = rb->opendir(dps->dirname); -#endif if (!dir) return false; /* open error */ /* walk through the directory content */ -#ifdef HAVE_DIRCACHE - while(result && (0 != (entry = rb->readdir_cached(dir)))) -#else while(result && (0 != (entry = rb->readdir(dir)))) -#endif { /* append name to current directory */ rb->snprintf(dps->dirname+dirlen, dps->len-dirlen, "/%s", @@ -189,12 +160,7 @@ static bool _dir_properties(DPS* dps) result = false; rb->yield(); } -#ifdef HAVE_DIRCACHE - rb->closedir_cached(dir); -#else rb->closedir(dir); -#endif - return result; } @@ -256,30 +222,17 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file) /* determine if it's a file or a directory */ bool found = false; -#ifdef HAVE_DIRCACHE - DIRCACHED* dir; - struct dircache_entry* entry; -#else DIR* dir; struct dirent* entry; -#endif char* ptr = rb->strrchr((char*)file, '/') + 1; int dirlen = (ptr - (char*)file); rb->strncpy(str_dirname, (char*)file, dirlen); str_dirname[dirlen] = 0; -#ifdef HAVE_DIRCACHE - dir = rb->opendir_cached(str_dirname); -#else dir = rb->opendir(str_dirname); -#endif if (dir) { -#ifdef HAVE_DIRCACHE - while(0 != (entry = rb->readdir_cached(dir))) -#else while(0 != (entry = rb->readdir(dir))) -#endif { if(!rb->strcmp(entry->d_name, file+dirlen)) { @@ -288,11 +241,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file) break; } } -#ifdef HAVE_DIRCACHE - rb->closedir_cached(dir); -#else rb->closedir(dir); -#endif } /* now we know if it's a file or a dir or maybe something failed */ |