diff options
| author | Hein-Pieter van Braam | 2017-10-03 12:24:11 +0200 |
|---|---|---|
| committer | GitHub | 2017-10-03 12:24:11 +0200 |
| commit | 2bece6bbd35c53390b2d3eedcf9b6d9949db518d (patch) | |
| tree | aad5340ed55e7727d50d6beb438cc843c78051e2 /platform/javascript/os_javascript.cpp | |
| parent | cc407847286e8033252db8caa382857a5601fbf2 (diff) | |
| parent | 7b23665e728fe10cd0eedb54824aaeae4ae23758 (diff) | |
| download | godot-2bece6bbd35c53390b2d3eedcf9b6d9949db518d.tar.gz godot-2bece6bbd35c53390b2d3eedcf9b6d9949db518d.tar.zst godot-2bece6bbd35c53390b2d3eedcf9b6d9949db518d.zip | |
Diffstat (limited to 'platform/javascript/os_javascript.cpp')
| -rw-r--r-- | platform/javascript/os_javascript.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 82a840961..f6446e77d 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -825,7 +825,7 @@ bool OS_JavaScript::main_loop_iterate() { if (!main_loop) return false; - if (time_to_save_sync >= 0) { + if (idbfs_available && time_to_save_sync >= 0) { int64_t newtime = get_ticks_msec(); int64_t elapsed = newtime - last_sync_time; last_sync_time = newtime; @@ -915,10 +915,10 @@ String OS_JavaScript::get_executable_path() const { void OS_JavaScript::_close_notification_funcs(const String &p_file, int p_flags) { - print_line("close " + p_file + " flags " + itos(p_flags)); - if (p_file.begins_with("/userfs") && p_flags & FileAccess::WRITE) { - static_cast<OS_JavaScript *>(get_singleton())->last_sync_time = OS::get_singleton()->get_ticks_msec(); - static_cast<OS_JavaScript *>(get_singleton())->time_to_save_sync = 5000; //five seconds since last save + OS_JavaScript *os = static_cast<OS_JavaScript *>(get_singleton()); + if (os->idbfs_available && p_file.begins_with("/userfs") && p_flags & FileAccess::WRITE) { + os->last_sync_time = OS::get_singleton()->get_ticks_msec(); + os->time_to_save_sync = 5000; //five seconds since last save } } @@ -993,6 +993,16 @@ bool OS_JavaScript::_check_internal_feature_support(const String &p_feature) { return p_feature == "web" || p_feature == "s3tc"; // TODO check for these features really being available } +void OS_JavaScript::set_idbfs_available(bool p_idbfs_available) { + + idbfs_available = p_idbfs_available; +} + +bool OS_JavaScript::is_userfs_persistent() const { + + return idbfs_available; +} + OS_JavaScript::OS_JavaScript(const char *p_execpath, GetDataDirFunc p_get_data_dir_func) { set_cmdline(p_execpath, get_cmdline_args()); main_loop = NULL; @@ -1004,6 +1014,7 @@ OS_JavaScript::OS_JavaScript(const char *p_execpath, GetDataDirFunc p_get_data_d get_data_dir_func = p_get_data_dir_func; FileAccessUnix::close_notification_func = _close_notification_funcs; + idbfs_available = false; time_to_save_sync = -1; } |
