Eeschema: fix save-as dispatching from new file
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5937
This commit is contained in:
parent
2e6968e7eb
commit
7b5d628e4b
|
@ -698,7 +698,7 @@ bool SCH_EDIT_FRAME::SaveProject()
|
||||||
wxString fileName = Prj().AbsolutePath( Schematic().Root().GetFileName() );
|
wxString fileName = Prj().AbsolutePath( Schematic().Root().GetFileName() );
|
||||||
wxFileName fn = fileName;
|
wxFileName fn = fileName;
|
||||||
|
|
||||||
if( !fn.IsDirWritable() )
|
if( fn.IsOk() && !fn.IsDirWritable() )
|
||||||
{
|
{
|
||||||
msg = wxString::Format( _( "Directory \"%s\" is not writable." ), fn.GetPath() );
|
msg = wxString::Format( _( "Directory \"%s\" is not writable." ), fn.GetPath() );
|
||||||
DisplayError( this, msg );
|
DisplayError( this, msg );
|
||||||
|
@ -717,6 +717,9 @@ bool SCH_EDIT_FRAME::SaveProject()
|
||||||
// Convert legacy schematics file name extensions for the new format.
|
// Convert legacy schematics file name extensions for the new format.
|
||||||
wxFileName tmpFn = screen->GetFileName();
|
wxFileName tmpFn = screen->GetFileName();
|
||||||
|
|
||||||
|
if( !tmpFn.IsOk() )
|
||||||
|
continue;
|
||||||
|
|
||||||
if( tmpFn.GetExt() == KiCadSchematicFileExtension )
|
if( tmpFn.GetExt() == KiCadSchematicFileExtension )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -761,7 +764,7 @@ bool SCH_EDIT_FRAME::SaveProject()
|
||||||
// Convert legacy schematics file name extensions for the new format.
|
// Convert legacy schematics file name extensions for the new format.
|
||||||
wxFileName tmpFn = screen->GetFileName();
|
wxFileName tmpFn = screen->GetFileName();
|
||||||
|
|
||||||
if( tmpFn.GetExt() != KiCadSchematicFileExtension )
|
if( tmpFn.IsOk() && tmpFn.GetExt() != KiCadSchematicFileExtension )
|
||||||
{
|
{
|
||||||
updateFileType = true;
|
updateFileType = true;
|
||||||
tmpFn.SetExt( KiCadSchematicFileExtension );
|
tmpFn.SetExt( KiCadSchematicFileExtension );
|
||||||
|
@ -771,7 +774,7 @@ bool SCH_EDIT_FRAME::SaveProject()
|
||||||
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
|
SCH_SHEET* sheet = static_cast<SCH_SHEET*>( item );
|
||||||
wxFileName sheetFileName = sheet->GetFileName();
|
wxFileName sheetFileName = sheet->GetFileName();
|
||||||
|
|
||||||
if( sheetFileName.GetExt() == KiCadSchematicFileExtension )
|
if( !sheetFileName.IsOk() || sheetFileName.GetExt() == KiCadSchematicFileExtension )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sheetFileName.SetExt( KiCadSchematicFileExtension );
|
sheetFileName.SetExt( KiCadSchematicFileExtension );
|
||||||
|
|
Loading…
Reference in New Issue