diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-01 08:21:27 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2022-11-01 08:21:27 +0100 |
commit | a2c0ea248d2f69e6b97ff109fda43304afe8cfe0 (patch) | |
tree | 1bf76aa127e5d405ff22e6e9c7358276269e4b00 /servers | |
parent | 5dfde1e7bdb5e116996087e8661ffd634fdcfea9 (diff) | |
parent | 264ce15a8312497ec038d920246f1aaf7b505175 (diff) |
Merge pull request #62418 from Calinou/movie-maker-warn-on-low-disk-space
Warn if available disk space is low when Movie Maker mode is enabled
Diffstat (limited to 'servers')
-rw-r--r-- | servers/movie_writer/movie_writer.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/servers/movie_writer/movie_writer.cpp b/servers/movie_writer/movie_writer.cpp index 2164dca29e..0edce4ced6 100644 --- a/servers/movie_writer/movie_writer.cpp +++ b/servers/movie_writer/movie_writer.cpp @@ -105,6 +105,21 @@ void MovieWriter::get_supported_extensions(List<String> *r_extensions) const { void MovieWriter::begin(const Size2i &p_movie_size, uint32_t p_fps, const String &p_base_path) { project_name = GLOBAL_GET("application/config/name"); + + print_line(vformat("Movie Maker mode enabled, recording movie at %d FPS...", p_fps)); + + // Check for available disk space and warn the user if needed. + Ref<DirAccess> dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + String path = p_base_path.get_basename(); + if (path.is_relative_path()) { + path = "res://" + path; + } + dir->open(path); + if (dir->get_space_left() < 10 * Math::pow(1024.0, 3.0)) { + // Less than 10 GiB available. + WARN_PRINT(vformat("Current available space on disk is low (%s). MovieWriter will fail during movie recording if the disk runs out of available space.", String::humanize_size(dir->get_space_left()))); + } + mix_rate = get_audio_mix_rate(); AudioDriverDummy::get_dummy_singleton()->set_mix_rate(mix_rate); AudioDriverDummy::get_dummy_singleton()->set_speaker_mode(AudioDriver::SpeakerMode(get_audio_speaker_mode())); |