summaryrefslogtreecommitdiff
path: root/editor/project_manager.cpp
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-05-20 14:34:04 +0200
committerGitHub <noreply@github.com>2021-05-20 14:34:04 +0200
commitf2d55f3c0fabcd4ba4c14d56a6abd4627ebafc4a (patch)
treeb02c159ca8e6d5fabc13d0d1910436c6e98e3fe6 /editor/project_manager.cpp
parenta6a75e2c095d67ffb5a40a6e65f9901bcfd54667 (diff)
parent056deefa55fe90659ac3b13bde1b6df5f22c8aae (diff)
Merge pull request #48863 from Ev1lbl0w/bugfix-zip_import
Fix zip_root not being defined when importing by drag&drop
Diffstat (limited to 'editor/project_manager.cpp')
-rw-r--r--editor/project_manager.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 1ffe4853a0..2d0ff24723 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -100,7 +100,6 @@ private:
FileDialog *fdialog_install;
String zip_path;
String zip_title;
- String zip_root;
AcceptDialog *dialog_error;
String fav_dir;
@@ -201,9 +200,7 @@ private:
char fname[16384];
ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
- String fname_str = String(fname);
- if (fname_str.ends_with("project.godot")) {
- zip_root = fname_str.substr(0, fname_str.rfind("project.godot"));
+ if (String(fname).ends_with("project.godot")) {
break;
}
@@ -524,7 +521,24 @@ private:
return;
}
+ // Find the zip_root
+ String zip_root;
int ret = unzGoToFirstFile(pkg);
+ while (ret == UNZ_OK) {
+ unz_file_info info;
+ char fname[16384];
+ unzGetCurrentFileInfo(pkg, &info, fname, 16384, nullptr, 0, nullptr, 0);
+
+ String name = fname;
+ if (name.ends_with("project.godot")) {
+ zip_root = name.substr(0, name.rfind("project.godot"));
+ break;
+ }
+
+ ret = unzGoToNextFile(pkg);
+ }
+
+ ret = unzGoToFirstFile(pkg);
Vector<String> failed_files;