summaryrefslogtreecommitdiff
path: root/editor/editor_asset_installer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_asset_installer.cpp')
-rw-r--r--editor/editor_asset_installer.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp
index 2537c4d4a8..7dcb9a4088 100644
--- a/editor/editor_asset_installer.cpp
+++ b/editor/editor_asset_installer.cpp
@@ -64,8 +64,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
package_path = p_path;
Set<String> files_sorted;
- FileAccess *src_f = nullptr;
- zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
+ zlib_filefunc_def io = zipio_create_io();
unzFile pkg = unzOpen2(p_path.utf8().get_data(), &io);
if (!pkg) {
@@ -238,8 +237,7 @@ void EditorAssetInstaller::open(const String &p_path, int p_depth) {
}
void EditorAssetInstaller::ok_pressed() {
- FileAccess *src_f = nullptr;
- zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
+ zlib_filefunc_def io = zipio_create_io();
unzFile pkg = unzOpen2(package_path.utf8().get_data(), &io);
if (!pkg) {
@@ -280,7 +278,7 @@ void EditorAssetInstaller::ok_pressed() {
dirpath = dirpath.substr(0, dirpath.length() - 1);
}
- DirAccessRef da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
+ Ref<DirAccess> da = DirAccess::create(DirAccess::ACCESS_RESOURCES);
da->make_dir(dirpath);
} else {
Vector<uint8_t> data;
@@ -291,10 +289,9 @@ void EditorAssetInstaller::ok_pressed() {
unzReadCurrentFile(pkg, data.ptrw(), data.size());
unzCloseCurrentFile(pkg);
- FileAccess *f = FileAccess::open(path, FileAccess::WRITE);
- if (f) {
+ Ref<FileAccess> f = FileAccess::open(path, FileAccess::WRITE);
+ if (f.is_valid()) {
f->store_buffer(data.ptr(), data.size());
- memdelete(f);
} else {
failed_files.push_back(path);
}