From 26dbd7c697f0bce0dd6d8f07fb595c126a4261a3 Mon Sep 17 00:00:00 2001 From: Dario Date: Sun, 8 Dec 2024 14:35:54 -0300 Subject: [PATCH] Handle error case for std::filesystem::space. --- UnleashedRecomp/locale/locale.h | 4 ++-- UnleashedRecomp/ui/installer_wizard.cpp | 24 +++++++++++------------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/UnleashedRecomp/locale/locale.h b/UnleashedRecomp/locale/locale.h index a59c892..0513000 100644 --- a/UnleashedRecomp/locale/locale.h +++ b/UnleashedRecomp/locale/locale.h @@ -167,13 +167,13 @@ inline static std::unordered_map 0) ? Localise("Installer_Step_AvailableSpace").c_str() : "", availableGiB); + snprintf(descriptionText, sizeof(descriptionText), "%s%s\n%s", GetWizardText(g_currentPage).c_str(), requiredSpaceText, availableSpaceText); } else if (g_currentPage == WizardPage::InstallSucceeded) { @@ -1109,8 +1103,12 @@ static void InstallerStart() static bool InstallerParseSources() { - std::filesystem::space_info spaceInfo = std::filesystem::space(g_installPath); - g_installerAvailableSize = spaceInfo.available; + std::error_code spaceErrorCode; + std::filesystem::space_info spaceInfo = std::filesystem::space(g_installPath, spaceErrorCode); + if (!spaceErrorCode) + { + g_installerAvailableSize = spaceInfo.available; + } Installer::Input installerInput; installerInput.gameSource = g_gameSourcePath;