| 326 | } |
| 327 | |
| 328 | void GDREPackedData::remove_path(const String &p_path) { |
| 329 | String simplified_path = p_path.simplify_path().trim_prefix("res://"); |
| 330 | |
| 331 | PathMD5 pmd5(simplified_path.md5_buffer()); |
| 332 | if (!files.has(pmd5)) { |
| 333 | return; |
| 334 | } |
| 335 | |
| 336 | // Search for directory. |
| 337 | PackedDir *cd = root; |
| 338 | |
| 339 | if (simplified_path.contains_char('/')) { // In a subdirectory. |
| 340 | Vector<String> ds = simplified_path.get_base_dir().split("/"); |
| 341 | |
| 342 | for (int j = 0; j < ds.size(); j++) { |
| 343 | if (!cd->subdirs.has(ds[j])) { |
| 344 | return; // Subdirectory does not exist, do not bother creating. |
| 345 | } else { |
| 346 | cd = cd->subdirs[ds[j]]; |
| 347 | } |
| 348 | } |
| 349 | } |
| 350 | |
| 351 | if (file_map.has(p_path.simplify_path())) { |
| 352 | file_map.erase(p_path.simplify_path()); |
| 353 | } |
| 354 | |
| 355 | cd->files.erase(simplified_path.get_file()); |
| 356 | |
| 357 | files.erase(pmd5); |
| 358 | } |
| 359 | |
| 360 | void GDREPackedData::set_disabled(bool p_disabled) { |
| 361 | if (p_disabled) { |
no test coverage detected