summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2020-02-03 21:35:00 +0100
committerHugo Locurcio <hugo.locurcio@hugo.pro>2020-02-03 21:35:00 +0100
commit34b747bac0c07cad64b0615664488f68f01c0d62 (patch)
tree49542ec51ec63be24f9c9d9159685e09cf72a421 /editor
parentc4daac279b8ec6f4893056ba6717624f701ab970 (diff)
Allow existing hidden files/directories when creating a new project
For instance, this lets users initialize a Git repository and still be able to create a project in the directory afterwards. This closes https://github.com/godotengine/godot-proposals/issues/291.
Diffstat (limited to 'editor')
-rw-r--r--editor/project_manager.cpp26
1 files changed, 17 insertions, 9 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 30e31cb530..2aaee5661e 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -163,7 +163,7 @@ private:
}
if (valid_path == "") {
- set_message(TTR("The path does not exist."), MESSAGE_ERROR);
+ set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
return "";
@@ -177,7 +177,7 @@ private:
}
if (valid_install_path == "") {
- set_message(TTR("The path does not exist."), MESSAGE_ERROR, INSTALL_PATH);
+ set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR, INSTALL_PATH);
memdelete(d);
get_ok()->set_disabled(true);
return "";
@@ -195,7 +195,7 @@ private:
unzFile pkg = unzOpen2(valid_path.utf8().get_data(), &io);
if (!pkg) {
- set_message(TTR("Error opening package file, not in ZIP format."), MESSAGE_ERROR);
+ set_message(TTR("Error opening package file (it's not in ZIP format)."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
unzClose(pkg);
@@ -216,7 +216,7 @@ private:
}
if (ret == UNZ_END_OF_LIST_OF_FILE) {
- set_message(TTR("Invalid '.zip' project file, does not contain a 'project.godot' file."), MESSAGE_ERROR);
+ set_message(TTR("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
unzClose(pkg);
@@ -230,7 +230,11 @@ private:
bool is_empty = true;
String n = d->get_next();
while (n != String()) {
- if (n != "." && n != "..") {
+ if (!n.begins_with(".")) {
+ // Allow `.`, `..` (reserved current/parent folder names)
+ // and hidden files/folders to be present.
+ // For instance, this lets users initialize a Git repository
+ // and still be able to create a project in the directory afterwards.
is_empty = false;
break;
}
@@ -247,7 +251,7 @@ private:
}
} else {
- set_message(TTR("Please choose a 'project.godot' or '.zip' file."), MESSAGE_ERROR);
+ set_message(TTR("Please choose a \"project.godot\" or \".zip\" file."), MESSAGE_ERROR);
memdelete(d);
install_path_container->hide();
get_ok()->set_disabled(true);
@@ -256,7 +260,7 @@ private:
} else if (valid_path.ends_with("zip")) {
- set_message(TTR("Directory already contains a Godot project."), MESSAGE_ERROR, INSTALL_PATH);
+ set_message(TTR("This directory already contains a Godot project."), MESSAGE_ERROR, INSTALL_PATH);
memdelete(d);
get_ok()->set_disabled(true);
return "";
@@ -269,7 +273,11 @@ private:
bool is_empty = true;
String n = d->get_next();
while (n != String()) {
- if (n != "." && n != "..") { // i don't know if this is enough to guarantee an empty dir
+ if (!n.begins_with(".")) {
+ // Allow `.`, `..` (reserved current/parent folder names)
+ // and hidden files/folders to be present.
+ // For instance, this lets users initialize a Git repository
+ // and still be able to create a project in the directory afterwards.
is_empty = false;
break;
}
@@ -332,7 +340,7 @@ private:
install_path_container->show();
get_ok()->set_disabled(false);
} else {
- set_message(TTR("Please choose a 'project.godot' or '.zip' file."), MESSAGE_ERROR);
+ set_message(TTR("Please choose a \"project.godot\" or \".zip\" file."), MESSAGE_ERROR);
get_ok()->set_disabled(true);
return;
}