wx: only rename config if new file doesn't exist
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>
This commit is contained in:
parent
0a95486fd8
commit
504597120f
|
@ -260,17 +260,13 @@ bool wxvbamApp::OnInit()
|
||||||
// /MIGRATION
|
// /MIGRATION
|
||||||
// migrate from 'vbam.{cfg,conf}' to 'vbam.ini' to manage a single config
|
// migrate from 'vbam.{cfg,conf}' to 'vbam.ini' to manage a single config
|
||||||
// file for all platforms.
|
// file for all platforms.
|
||||||
#if !defined(__WXMSW__) && !defined(__APPLE__)
|
|
||||||
wxString oldConf(GetConfigurationPath() + wxT(FILE_SEP) + wxT("vbam.conf"));
|
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"));
|
wxString newConf(GetConfigurationPath() + wxT(FILE_SEP) + wxT("vbam.ini"));
|
||||||
if (wxFileExists(oldConf))
|
|
||||||
{
|
if (!wxFileExists(newConf) && wxFileExists(oldConf))
|
||||||
wxRenameFile(oldConf, newConf, false);
|
wxRenameFile(oldConf, newConf, false);
|
||||||
}
|
|
||||||
// /END_MIGRATION
|
// /END_MIGRATION
|
||||||
|
|
||||||
cfg = new wxFileConfig(wxT("vbam"), wxEmptyString,
|
cfg = new wxFileConfig(wxT("vbam"), wxEmptyString,
|
||||||
vbamconf.GetFullPath(),
|
vbamconf.GetFullPath(),
|
||||||
wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
|
wxEmptyString, wxCONFIG_USE_LOCAL_FILE);
|
||||||
|
|
Loading…
Reference in New Issue