return ret;
}
+static gboolean __remove_all_files(const gchar *pathname)
+{
+ DIR *dir_ptr = NULL;
+ struct dirent *file = NULL;
+
+ if ((dir_ptr = opendir(pathname)) == NULL)
+ return TRUE;
+
+ while ((file = readdir(dir_ptr)) != NULL) {
+ if (strncmp(file->d_name, ".", 1) == 0 || strncmp(file->d_name, "..", 2) == 0)
+ continue;
+
+ if (__remove_file(pathname, file->d_name) != TRUE) {
+ ERR("Cannot remove [%s/%s]", pathname, file->d_name);
+ closedir(dir_ptr);
+
+ return FALSE;
+ }
+ }
+
+ closedir(dir_ptr);
+
+ return TRUE;
+}
+
static gboolean __remove_configuration(const gchar *pathname)
{
int ret = 0;
- if (__remove_file(pathname, "settings") != TRUE) {
- ERR("Cannot remove [%s/settings]", pathname);
- return FALSE;
- }
- if (__remove_file(pathname, "data") != TRUE) {
- ERR("Cannot remove [%s/data]", pathname);
+ if (__remove_all_files(pathname) != TRUE) {
+ ERR("Cannot remove [%s] directory", pathname);
return FALSE;
}