Don't treat project Save As path as a path and file name.

The single string ctor of wxFileName treats the string as a path and file
name.  If there is a dot in the last path name, it assumes that the last
path is actually a file name and extension.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/10116
This commit is contained in:
Wayne Stambaugh 2021-12-26 17:02:54 -05:00
parent 3a8ffd40b8
commit fcc497509a
1 changed files with 2 additions and 2 deletions

View File

@ -561,7 +561,7 @@ int KICAD_MANAGER_CONTROL::SaveProjectAs( const TOOL_EVENT& aEvent )
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
return -1; return -1;
wxFileName newProjectDir( dlg.GetPath() ); wxFileName newProjectDir( dlg.GetPath(), wxEmptyString );
if( !newProjectDir.IsAbsolute() ) if( !newProjectDir.IsAbsolute() )
newProjectDir.MakeAbsolute(); newProjectDir.MakeAbsolute();
@ -592,7 +592,7 @@ int KICAD_MANAGER_CONTROL::SaveProjectAs( const TOOL_EVENT& aEvent )
} }
const wxString& newProjectDirPath = newProjectDir.GetFullPath(); const wxString& newProjectDirPath = newProjectDir.GetFullPath();
const wxString& newProjectName = newProjectDir.GetName(); const wxString& newProjectName = newProjectDir.GetDirs().Last();
wxDir currentProjectDir( currentProjectDirPath ); wxDir currentProjectDir( currentProjectDirPath );
SAVE_AS_TRAVERSER traverser( m_frame, currentProjectDirPath, currentProjectName, SAVE_AS_TRAVERSER traverser( m_frame, currentProjectDirPath, currentProjectName,