Create blank ini file before editing it, if it doesn't already exists. This prevents the editor from prompting to create it.

This commit is contained in:
Rachel Bryk 2013-09-14 20:27:54 -04:00
parent 6dc16a59f8
commit 550c855ae6
1 changed files with 8 additions and 2 deletions

View File

@ -1077,8 +1077,8 @@ bool CISOProperties::SaveGameConfig()
bool success = GameIniLocal.Save(GameIniFileLocal.c_str()); bool success = GameIniLocal.Save(GameIniFileLocal.c_str());
// If the resulting file is empty, delete it. Kind of a hack, but meh. // If the resulting file is empty, delete it. Kind of a hack, but meh.
if (success && File::GetSize(GameIniFileLocal) == 0) //if (success && File::GetSize(GameIniFileLocal) == 0)
File::Delete(GameIniFileLocal); // File::Delete(GameIniFileLocal);
return success; return success;
} }
@ -1119,6 +1119,12 @@ void CISOProperties::LaunchExternalEditor(const std::string& filename)
void CISOProperties::OnEditConfig(wxCommandEvent& WXUNUSED (event)) void CISOProperties::OnEditConfig(wxCommandEvent& WXUNUSED (event))
{ {
SaveGameConfig(); SaveGameConfig();
// Create blank file to prevent editor from prompting to create it.
if (!File::Exists(GameIniFileLocal))
{
std::fstream blankFile(GameIniFileLocal);
blankFile.close();
}
LaunchExternalEditor(GameIniFileLocal); LaunchExternalEditor(GameIniFileLocal);
GameIniLocal.Load(GameIniFileLocal); GameIniLocal.Load(GameIniFileLocal);
LoadGameConfig(); LoadGameConfig();