You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Porting 3.0 filessytem_dock's context menu to 2.1
This commit is contained in:
@@ -409,16 +409,22 @@ void DependencyRemoveDialog::show(const Vector<String> &to_erase) {
|
||||
}
|
||||
|
||||
void DependencyRemoveDialog::ok_pressed() {
|
||||
|
||||
|
||||
DirAccess *da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
|
||||
for (Map<String, TreeItem *>::Element *E = files.front(); E; E = E->next()) {
|
||||
|
||||
if (ResourceCache::has(E->key())) {
|
||||
Resource *res = ResourceCache::get(E->key());
|
||||
res->set_path(""); //clear reference to path
|
||||
if (da->dir_exists(E->key()))
|
||||
{
|
||||
String path = OS::get_singleton()->get_resource_dir() + E->key().replace_first("res://", "/");
|
||||
OS::get_singleton()->move_path_to_trash(path);
|
||||
EditorFileSystem::get_singleton()->scan();
|
||||
} else {
|
||||
if (ResourceCache::has(E->key())) {
|
||||
Resource *res = ResourceCache::get(E->key());
|
||||
res->set_path(""); //clear reference to path
|
||||
}
|
||||
da->remove(E->key());
|
||||
EditorFileSystem::get_singleton()->update_file(E->key());
|
||||
}
|
||||
da->remove(E->key());
|
||||
EditorFileSystem::get_singleton()->update_file(E->key());
|
||||
}
|
||||
memdelete(da);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user