diff options
author | Robert Kukla <roolku@rockbox.org> | 2007-11-21 21:28:27 +0000 |
---|---|---|
committer | Robert Kukla <roolku@rockbox.org> | 2007-11-21 21:28:27 +0000 |
commit | d87b037efe7d001902c0cde992e1633ff9f70061 (patch) | |
tree | ddea298e51d73443aad0d31fca7d59311444efab /apps/recorder/albumart.c | |
parent | a2ad8537af659972b2e859c99c0ff75e374b73f9 (diff) | |
download | rockbox-d87b037efe7d001902c0cde992e1633ff9f70061.tar.gz rockbox-d87b037efe7d001902c0cde992e1633ff9f70061.zip |
consolidate the 3 file_exists() functions into one; use the version that explicitly uses dircache; give dir_exists() the same treatment for consistency
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15742 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/recorder/albumart.c')
-rw-r--r-- | apps/recorder/albumart.c | 21 |
1 files changed, 1 insertions, 20 deletions
diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c index d99280ce85..6aaf3885d7 100644 --- a/apps/recorder/albumart.c +++ b/apps/recorder/albumart.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include "buffering.h" | 26 | #include "buffering.h" |
27 | #include "dircache.h" | 27 | #include "dircache.h" |
28 | #include "debug.h" | 28 | #include "debug.h" |
29 | #include "misc.h" | ||
29 | 30 | ||
30 | 31 | ||
31 | /* Strip filename from a full path | 32 | /* Strip filename from a full path |
@@ -89,26 +90,6 @@ static char* strip_extension(char* buf, int buf_size, const char* file) | |||
89 | return buf; | 90 | return buf; |
90 | } | 91 | } |
91 | 92 | ||
92 | /* Test file existence, using dircache of possible */ | ||
93 | static bool file_exists(const char *file) | ||
94 | { | ||
95 | int fd; | ||
96 | |||
97 | if (!file || strlen(file) <= 0) | ||
98 | return false; | ||
99 | |||
100 | #ifdef HAVE_DIRCACHE | ||
101 | if (dircache_is_enabled()) | ||
102 | return (dircache_get_entry_ptr(file) != NULL); | ||
103 | #endif | ||
104 | |||
105 | fd = open(file, O_RDONLY); | ||
106 | if (fd < 0) | ||
107 | return false; | ||
108 | close(fd); | ||
109 | return true; | ||
110 | } | ||
111 | |||
112 | /* Make sure part of path only contain chars valid for a FAT32 long name. | 93 | /* Make sure part of path only contain chars valid for a FAT32 long name. |
113 | * Double quotes are replaced with single quotes, other unsupported chars | 94 | * Double quotes are replaced with single quotes, other unsupported chars |
114 | * are replaced with an underscore. | 95 | * are replaced with an underscore. |