언어 설정

Menu
Sites
Language
How to delete a image permanently from DCIM/CAMERA Folder

Hi all,

I had launched a file browser for selecting images by setting appcontrol settings
like

mime: images/* 

for selecting the images & i am deleting the selected image via remove(filenpath);

the image is getting deleted successfully from the filepath

but when i launch the image viewer appcontrol the same image is shown for selection , when i try to select the same image i am getting Toast like "unable to load the photo" 

how to delete the image such that it should not be listed when i launch image viewer for selecting the images.

the code is as follows

 

static void launch_file_cb(void *data, Evas_Object *obj, void *event_info) {
    app_control_h app_control;

    app_control_create(&app_control);
    app_control_set_operation(app_control, APP_CONTROL_OPERATION_PICK);

    app_control_set_mime(app_control, "image/*");

    if (app_control_send_launch_request(app_control, app_control_result, NULL) //sending launch request here
            == APP_CONTROL_ERROR_NONE) {
        dlog_print(DLOG_INFO, LOG_TAG, "Succeeded to launch a viewer app.");

    } else {
        dlog_print(DLOG_ERROR, LOG_TAG, "Failed to launch a viewer app.");
    }

    app_control_destroy(app_control);
}

static void app_control_result(app_control_h request, app_control_h reply,
        app_control_result_e result, void *user_data) {
    char *value;
    int ret;
    if (result == APP_CONTROL_RESULT_SUCCEEDED) {
        ret = app_control_get_extra_data(reply, "path", &value);
        if (ret == APP_CONTROL_ERROR_NONE) {
            dlog_print(DLOG_INFO, LOG_TAG,
                    "[app_control_result_cb] Succeeded: value(%s)", value);
           

remove(value);// deleting the file here

        } else {
            dlog_print(DLOG_ERROR, LOG_TAG,
                    "[app_control_result_cb] Failed, Error code: %d", ret);
        }
    } else {
        dlog_print(DLOG_ERROR, LOG_TAG,
                "[app_control_result_cb] APP_CONTROL_RESULT_FAILED. Error code: %d",
                result);
    }
}
Regards
Harish K 

 

 

 

 

 

 

 

 

 

 

 

 

Edited by: harish kumar kavali on 11 5월, 2015

Responses

1 댓글
Jean Yang

Hi , 

There is a file manager smple in IDE, it has the delete operation, I pasted the related code for you:

static int _fs_operation_delete(fs_operation *operation)
{
    Eina_List *list = NULL;
    node_info *data = NULL;

    int result = RESULT_TYPE_OK;
    EINA_LIST_FOREACH(operation->source_list, list, data)
    {
        if (operation->is_canceled)
        {
            result = RESULT_TYPE_OPERATION_INTERUPTED;
            break;
        }

        char *temp_name = common_util_strconcat(data->parent_path, "/", data->name, NULL);

        if (data->type == FILE_TYPE_DIR && model_utils_file_is_dir(temp_name))
        {
            if (!_fs_operation_file_recursive_rm(temp_name))
            {
                ERR("Failed to delete dir %s recursively", temp_name);
            }
        }
        else if (model_utils_is_file_exists(temp_name))
        {
            if (remove(temp_name) < 0)
            {
                ERR("Failed to delete file %s", temp_name);
            }
        }
        else
        {
            ERR("%s %s doesn't exist", (data->type == FILE_TYPE_DIR)?"Dir":"File", temp_name);
        }
        free(temp_name);
    }

    return result;
}