Skip to content

Commit

Permalink
wx: only rename config if new file doesn't exist
Browse files Browse the repository at this point in the history
Before trying to rename `vbam.conf` to `vbam.ini`, as we decided during
the XDG support work, first check if `vbam.ini` does not already exist.

If it already exists, use `vbam.ini` and do nothing with the
`vbam.conf`.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
  • Loading branch information
rkitover committed Apr 28, 2019
1 parent 0a95486 commit 5045971
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/wx/wxvbam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -260,17 +260,13 @@ bool wxvbamApp::OnInit()
// /MIGRATION
// migrate from 'vbam.{cfg,conf}' to 'vbam.ini' to manage a single config
// file for all platforms.
#if !defined(__WXMSW__) && !defined(__APPLE__)
wxString oldConf(GetConfigurationPath() + wxT(FILE_SEP) + wxT("vbam.conf"));
#else
wxString oldConf(GetConfigurationPath() + wxT(FILE_SEP) + wxT("vbam.cfg"));
#endif
wxString newConf(GetConfigurationPath() + wxT(FILE_SEP) + wxT("vbam.ini"));
if (wxFileExists(oldConf))
{
wxRenameFile(oldConf, newConf, false);
}

if (!wxFileExists(newConf) && wxFileExists(oldConf))
wxRenameFile(oldConf, newConf, false);
// /END_MIGRATION

cfg = new wxFileConfig(wxT("vbam"), wxEmptyString,
vbamconf.GetFullPath(),
wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
Expand Down

0 comments on commit 5045971

Please sign in to comment.