Skip to content

Commit

Permalink
C#: Clear existing data directory extracted from PCK
Browse files Browse the repository at this point in the history
  • Loading branch information
scgm0 authored and jss2a98aj committed Dec 7, 2024
1 parent 613f923 commit 00fcd22
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions modules/mono/godotsharp_dirs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,15 @@ class _GodotSharpDirs {
}
}
if (!has_data) {
// 3. Extract the data to a temporary location to load from there.
Ref<DirAccess> da = DirAccess::create_for_path(packed_path);
ERR_FAIL_NULL(da);
// 3. Extract the data to a temporary location to load from there, delete old data if it exists but is not up-to-date.
Ref<DirAccess> da;
if (DirAccess::exists(data_dir_root)) {
da = DirAccess::open(data_dir_root);
ERR_FAIL_NULL(da);
ERR_FAIL_COND(da->erase_contents_recursive() != OK);
}
da = DirAccess::create_for_path(packed_path);
ERR_FAIL_COND(da.is_null());
ERR_FAIL_COND(da->copy_dir(packed_path, data_dir_root) != OK);
}
api_assemblies_dir = data_dir_root;
Expand Down

0 comments on commit 00fcd22

Please sign in to comment.