Normalize the settings migration path to have no trailing slash
If we use the raw user input, it may or may not have a trailing slash on the directory name, and then if the user provides a trailing slash migrating the folders inside the old settings directory will fail.
This commit is contained in:
parent
ab797d191f
commit
cec258f7dd
|
@ -88,7 +88,10 @@ bool DIALOG_MIGRATE_SETTINGS::TransferDataFromWindow()
|
|||
if( m_btnPrevVer->GetValue() )
|
||||
{
|
||||
m_manager->SetMigrateLibraryTables( m_cbCopyLibraryTables->GetValue() );
|
||||
m_manager->SetMigrationSource( m_cbPath->GetValue() );
|
||||
|
||||
// Round-trip through a wxFileName object to remove any trailing separators
|
||||
wxFileName path( m_cbPath->GetValue(), wxEmptyString );
|
||||
m_manager->SetMigrationSource( path.GetPath() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "settings/json_settings.h"
|
||||
#include <regex>
|
||||
#include <wx/debug.h>
|
||||
#include <wx/dir.h>
|
||||
|
@ -523,6 +524,8 @@ bool SETTINGS_MANAGER::MigrateIfNeeded()
|
|||
return true;
|
||||
}
|
||||
|
||||
wxLogTrace( traceSettings, "Migrating from path %s", m_migration_source );
|
||||
|
||||
MIGRATION_TRAVERSER traverser( m_migration_source, path.GetFullPath(), m_migrateLibraryTables );
|
||||
wxDir source_dir( m_migration_source );
|
||||
|
||||
|
|
Loading…
Reference in New Issue