mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-29 17:19:44 -06:00
Merge pull request #5720 from JosJuice/file-metadata
FileUtil: Redesign Exists/IsDirectory/GetSize
This commit is contained in:
@ -359,18 +359,15 @@ void GameCubeConfigPane::ChooseSlotPath(bool is_slot_a, ExpansionInterface::TEXI
|
||||
|
||||
if (!filename.empty())
|
||||
{
|
||||
if (File::Exists(filename))
|
||||
if (memcard && File::Exists(filename))
|
||||
{
|
||||
if (memcard)
|
||||
GCMemcard memorycard(filename);
|
||||
if (!memorycard.IsValid())
|
||||
{
|
||||
GCMemcard memorycard(filename);
|
||||
if (!memorycard.IsValid())
|
||||
{
|
||||
WxUtils::ShowErrorDialog(wxString::Format(_("Cannot use that file as a memory card.\n%s\n"
|
||||
"is not a valid GameCube memory card file"),
|
||||
filename.c_str()));
|
||||
return;
|
||||
}
|
||||
WxUtils::ShowErrorDialog(wxString::Format(_("Cannot use that file as a memory card.\n%s\n"
|
||||
"is not a valid GameCube memory card file"),
|
||||
filename.c_str()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#include "DolphinWX/ISOProperties/ISOProperties.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cinttypes>
|
||||
#include <cstddef>
|
||||
#include <cstdio>
|
||||
@ -442,16 +443,12 @@ void CISOProperties::CreateGUIControls()
|
||||
sButtons->GetAffirmativeButton()->SetLabel(_("Close"));
|
||||
|
||||
// If there is no default gameini, disable the button.
|
||||
bool game_ini_exists = false;
|
||||
for (const std::string& ini_filename :
|
||||
SConfig::GetGameIniFilenames(game_id, m_open_iso->GetRevision()))
|
||||
{
|
||||
if (File::Exists(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + ini_filename))
|
||||
{
|
||||
game_ini_exists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
const std::vector<std::string> ini_names =
|
||||
SConfig::GetGameIniFilenames(game_id, m_open_iso->GetRevision());
|
||||
const bool game_ini_exists =
|
||||
std::any_of(ini_names.cbegin(), ini_names.cend(), [](const std::string& name) {
|
||||
return File::Exists(File::GetSysDirectory() + GAMESETTINGS_DIR DIR_SEP + name);
|
||||
});
|
||||
if (!game_ini_exists)
|
||||
EditConfigDefault->Disable();
|
||||
|
||||
|
@ -856,11 +856,9 @@ void InputConfigDialog::LoadProfile(wxCommandEvent&)
|
||||
std::string fname;
|
||||
InputConfigDialog::GetProfilePath(fname);
|
||||
|
||||
if (!File::Exists(fname))
|
||||
return;
|
||||
|
||||
IniFile inifile;
|
||||
inifile.Load(fname);
|
||||
if (!inifile.Load(fname))
|
||||
return;
|
||||
|
||||
controller->LoadConfig(inifile.GetOrCreateSection("Profile"));
|
||||
controller->UpdateReferences(g_controller_interface);
|
||||
|
Reference in New Issue
Block a user