Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_file/file_ops.c
| Show First 20 Lines • Show All 2,848 Lines • ▼ Show 20 Lines | static bool file_delete_poll(bContext *C) | ||||
| return poll; | return poll; | ||||
| } | } | ||||
| static bool file_delete_single(const FileSelectParams *params, | static bool file_delete_single(const FileSelectParams *params, | ||||
| FileDirEntry *file, | FileDirEntry *file, | ||||
| const char **r_error_message) | const char **r_error_message) | ||||
| { | { | ||||
| if (file->typeflag & FILE_TYPE_ASSET) { | |||||
| ID *id = filelist_file_get_id(file); | |||||
| if (!id) { | |||||
| *r_error_message = "File is not a local data-block asset."; | |||||
| return false; | |||||
| } | |||||
| ED_asset_clear_id(id); | |||||
| } | |||||
| else { | |||||
| char str[FILE_MAX]; | char str[FILE_MAX]; | ||||
| BLI_join_dirfile(str, sizeof(str), params->dir, file->relpath); | BLI_join_dirfile(str, sizeof(str), params->dir, file->relpath); | ||||
| if (BLI_delete_soft(str, r_error_message) != 0 || BLI_exists(str)) { | if (BLI_delete_soft(str, r_error_message) != 0 || BLI_exists(str)) { | ||||
| return false; | return false; | ||||
| } | } | ||||
| } | |||||
| return true; | return true; | ||||
| } | } | ||||
| static int file_delete_exec(bContext *C, wmOperator *op) | static int file_delete_exec(bContext *C, wmOperator *op) | ||||
| { | { | ||||
| wmWindowManager *wm = CTX_wm_manager(C); | wmWindowManager *wm = CTX_wm_manager(C); | ||||
| SpaceFile *sfile = CTX_wm_space_file(C); | SpaceFile *sfile = CTX_wm_space_file(C); | ||||
| ▲ Show 20 Lines • Show All 101 Lines • Show Last 20 Lines | |||||