1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Robert Kukla 2007-11-21 21:28:27 +00:00
parent a2ad8537af
commit d87b037efe
10 changed files with 50 additions and 65 deletions

View file

@ -360,35 +360,3 @@ void write_entry_to_file(int fd, sc_entry_t *entry)
}
rb->fdprintf(fd, "\n");
}
bool file_exists(char *filename)
{
int fd = rb->open(filename, O_RDONLY);
bool retval;
if (fd >= 0) {
rb->close(fd);
retval = true;
} else {
retval = false;
}
DEBUGF("Checked existence of the file '%s': %s\n",
filename, (retval ? "found" : "NOT FOUND"));
return retval;
}
bool dir_exists(char *path)
{
DIR* d = rb->opendir(path);
bool retval;
if (d != NULL) {
rb->closedir(d);
retval = true;
} else {
retval = false;
}
DEBUGF("Checked existence of the dir '%s': %s\n",
path, (retval ? "found" : "NOT FOUND"));
return retval;
}