media_svc_storage_type_e storage_type = 0;
const char *scan_ignore = ".scan_ignore";
bool find = false;
+ GDir *dir = NULL;
+ GError *error = NULL;
+ const char *name;
media_content_sec_debug("dir_path : %s", dir_path);
return _content_error_capi(MEDIA_CONTENT_TYPE, ret);
}
- DIR *dp = NULL;
- struct dirent entry;
- struct dirent *result = NULL;
-
char *leaf_path = NULL;
char search_path[MAX_PATH_LEN] = {0, };
}
while (STRING_VALID(search_path)) {
- dp = opendir(search_path);
- if (dp == NULL) {
+ dir = g_dir_open(search_path, 0, &error);
+ if (dir != NULL && error == NULL) {
+ while ((name = g_dir_read_name(dir))) {
+ if (strcmp(name, scan_ignore) == 0) {
+ media_content_sec_debug("Ignore path[%s]", search_path);
+ find = TRUE;
+ break;
+ }
+ }
+ } else {
*ignore = TRUE;
media_content_error("Open Directory fail");
- media_content_sec_debug("Open fail path[%s]", search_path);
- if (errno == EACCES || errno == EPERM)
+ if (error->code == G_FILE_ERROR_ACCES)
return MEDIA_CONTENT_ERROR_PERMISSION_DENIED;
else
return MEDIA_CONTENT_ERROR_INVALID_PARAMETER;
}
- media_content_retvm_if(dp == NULL, MEDIA_CONTENT_ERROR_INVALID_OPERATION, "Open Directory fail");
-
- while (!readdir_r(dp, &entry, &result)) {
- if (result == NULL)
- break;
-
- if (STRING_VALID(entry.d_name) && (strcmp(entry.d_name, scan_ignore) == 0)) {
- media_content_error("Find Ignore path");
- media_content_sec_debug("Ignore path[%s]", search_path);
- find = TRUE;
- break;
- } else {
- /*media_content_sec_debug("entry.d_name[%s]", entry.d_name);*/
- continue;
- }
- }
-
- if (dp) closedir(dp);
- dp = NULL;
+ if (dir)
+ g_dir_close(dir);
if (find) {
*ignore = TRUE;