| 177 | } |
| 178 | |
| 179 | bool OS_Android::copy_dynamic_library(const String &p_library_path, const String &p_target_dir, String *r_copy_path) { |
| 180 | if (!FileAccess::exists(p_library_path)) { |
| 181 | return false; |
| 182 | } |
| 183 | |
| 184 | Ref<DirAccess> da_ref = DirAccess::create_for_path(p_library_path); |
| 185 | if (da_ref.is_null()) { |
| 186 | return false; |
| 187 | } |
| 188 | |
| 189 | String copy_path = p_target_dir.path_join(p_library_path.get_file()); |
| 190 | bool copy_exists = FileAccess::exists(copy_path); |
| 191 | if (copy_exists) { |
| 192 | print_verbose("Deleting existing library copy " + copy_path); |
| 193 | if (da_ref->remove(copy_path) != OK) { |
| 194 | print_verbose("Unable to delete " + copy_path); |
| 195 | } |
| 196 | } |
| 197 | |
| 198 | print_verbose("Copying " + p_library_path + " to " + p_target_dir); |
| 199 | Error create_dir_result = da_ref->make_dir_recursive(p_target_dir); |
| 200 | if (create_dir_result == OK || create_dir_result == ERR_ALREADY_EXISTS) { |
| 201 | copy_exists = da_ref->copy(p_library_path, copy_path) == OK; |
| 202 | } |
| 203 | |
| 204 | if (copy_exists && r_copy_path != nullptr) { |
| 205 | *r_copy_path = copy_path; |
| 206 | } |
| 207 | |
| 208 | return copy_exists; |
| 209 | } |
| 210 | |
| 211 | Error OS_Android::open_dynamic_library(const String &p_path, void *&p_library_handle, GDExtensionData *p_data) { |
| 212 | String path = p_path; |