diff options
Diffstat (limited to 'core/os/os.cpp')
-rw-r--r-- | core/os/os.cpp | 67 |
1 files changed, 23 insertions, 44 deletions
diff --git a/core/os/os.cpp b/core/os/os.cpp index ca1b798e11..dc3fe29dca 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -32,8 +32,8 @@ #include "core/config/project_settings.h" #include "core/input/input.h" -#include "core/os/dir_access.h" -#include "core/os/file_access.h" +#include "core/io/dir_access.h" +#include "core/io/file_access.h" #include "core/os/midi_driver.h" #include "core/version_generated.gen.h" #include "servers/audio_server.h" @@ -47,37 +47,8 @@ OS *OS::get_singleton() { return singleton; } -uint32_t OS::get_ticks_msec() const { - return get_ticks_usec() / 1000; -} - -String OS::get_iso_date_time(bool local) const { - OS::Date date = get_date(local); - OS::Time time = get_time(local); - - String timezone; - if (!local) { - TimeZoneInfo zone = get_time_zone_info(); - if (zone.bias >= 0) { - timezone = "+"; - } - timezone = timezone + itos(zone.bias / 60).pad_zeros(2) + itos(zone.bias % 60).pad_zeros(2); - } else { - timezone = "Z"; - } - - return itos(date.year).pad_zeros(2) + - "-" + - itos(date.month).pad_zeros(2) + - "-" + - itos(date.day).pad_zeros(2) + - "T" + - itos(time.hour).pad_zeros(2) + - ":" + - itos(time.min).pad_zeros(2) + - ":" + - itos(time.sec).pad_zeros(2) + - timezone; +uint64_t OS::get_ticks_msec() const { + return get_ticks_usec() / 1000ULL; } double OS::get_unix_time() const { @@ -139,6 +110,10 @@ void OS::printerr(const char *p_format, ...) { va_end(argp); } +void OS::alert(const String &p_alert, const String &p_title) { + fprintf(stderr, "%s: %s\n", p_title.utf8().get_data(), p_alert.utf8().get_data()); +} + void OS::set_low_processor_usage_mode(bool p_enabled) { low_processor_usage_mode = p_enabled; } @@ -171,6 +146,10 @@ bool OS::is_stdout_verbose() const { return _verbose_stdout; } +bool OS::is_single_window() const { + return _single_window; +} + bool OS::is_stdout_debug_enabled() const { return _debug_stdout; } @@ -203,7 +182,7 @@ static void _OS_printres(Object *p_obj) { return; } - String str = itos(res->get_instance_id()) + String(res->get_class()) + ":" + String(res->get_name()) + " - " + res->get_path(); + String str = vformat("%s - %s - %s", res->to_string(), res->get_name(), res->get_path()); if (_OSPRF) { _OSPRF->store_line(str); } else { @@ -240,14 +219,6 @@ void OS::dump_resources_to_file(const char *p_file) { ResourceCache::dump(p_file); } -void OS::set_no_window_mode(bool p_enable) { - _no_window = p_enable; -} - -bool OS::is_no_window_mode_enabled() const { - return _no_window; -} - int OS::get_exit_code() const { return _exit_code; } @@ -316,7 +287,7 @@ String OS::get_resource_dir() const { } // Access system-specific dirs like Documents, Downloads, etc. -String OS::get_system_dir(SystemDir p_dir) const { +String OS::get_system_dir(SystemDir p_dir, bool p_shared_storage) const { return "."; } @@ -390,9 +361,17 @@ void OS::set_has_server_feature_callback(HasServerFeatureCallback p_callback) { } bool OS::has_feature(const String &p_feature) { - if (p_feature == get_name()) { + // Feature tags are always lowercase for consistency. + if (p_feature == get_name().to_lower()) { return true; } + + // Catch-all `linuxbsd` feature tag that matches on both Linux and BSD. + // This is the one exposed in the project settings dialog. + if (p_feature == "linuxbsd" && (get_name() == "Linux" || get_name() == "FreeBSD" || get_name() == "NetBSD" || get_name() == "OpenBSD" || get_name() == "BSD")) { + return true; + } + #ifdef DEBUG_ENABLED if (p_feature == "debug") { return true; |