static int _check_dir_path(const char *dir_path, uid_t uid)
{
- ms_user_storage_type_e storage_type;
+ int ret = MS_MEDIA_ERR_NONE;
+ ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
+
+ /* TODO: Remove MS_MEDIA_ERR_INVALID_PATH type. Use MS_MEDIA_ERR_INVALID_PARAMETER instead. (gtest related issue) */
+ ret = ms_user_get_storage_type(uid, dir_path, &storage_type);
+ MSAPI_RETVM_IF(ret != MS_MEDIA_ERR_NONE, MS_MEDIA_ERR_INVALID_PATH, "Invalid path");
- MSAPI_RETV_IF(!g_file_test(dir_path, G_FILE_TEST_IS_DIR), MS_MEDIA_ERR_INVALID_PATH);
+ /* dir_path can be a deleted path. */
+ if (g_file_test(dir_path, G_FILE_TEST_EXISTS)) {
+ /* Check only exist */
+ MSAPI_RETVM_IF(!g_file_test(dir_path, G_FILE_TEST_IS_DIR), MS_MEDIA_ERR_INVALID_PATH, "Not a directory");
+ }
- return ms_user_get_storage_type(uid, dir_path, &storage_type);
+ return MS_MEDIA_ERR_NONE;
}
/* receive message from media-server[function : ms_receive_message_from_scanner] */