1
0
mirror of https://github.com/godotengine/godot.git synced 2025-12-02 16:48:55 +00:00

Add error message when trying to load project from CWD.

This commit is contained in:
Pāvels Nadtočajevs
2025-11-16 10:09:23 +02:00
parent 8deb221829
commit a7358ddd12
7 changed files with 43 additions and 2 deletions

View File

@@ -1096,6 +1096,16 @@ Error OS_Unix::set_cwd(const String &p_cwd) {
return OK;
}
String OS_Unix::get_cwd() const {
String dir;
char real_current_dir_name[2048];
ERR_FAIL_NULL_V(getcwd(real_current_dir_name, 2048), ".");
if (dir.append_utf8(real_current_dir_name) != OK) {
dir = real_current_dir_name;
}
return dir;
}
bool OS_Unix::has_environment(const String &p_var) const {
return getenv(p_var.utf8().get_data()) != nullptr;
}