Try harder not to give a read-only path to save dialog
Fixes https://gitlab.com/kicad/code/kicad/-/issues/5937
This commit is contained in:
parent
35c7ba0a8a
commit
2153a7655b
|
@ -57,6 +57,7 @@
|
|||
#include <widgets/infobar.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <page_layout/ws_data_model.h>
|
||||
#include <wx/stdpaths.h>
|
||||
|
||||
bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName )
|
||||
{
|
||||
|
@ -80,10 +81,18 @@ bool SCH_EDIT_FRAME::SaveEEFile( SCH_SHEET* aSheet, bool aSaveUnderNewName )
|
|||
|
||||
if( aSaveUnderNewName )
|
||||
{
|
||||
wxString wildcards = KiCadSchematicFileWildcard();
|
||||
wxFileName savePath( Prj().GetProjectFullName() );
|
||||
|
||||
wxFileDialog dlg( this, _( "Schematic Files" ), wxPathOnly( Prj().GetProjectFullName() ),
|
||||
schematicFileName.GetFullName(), wildcards,
|
||||
if( !savePath.IsOk() || !savePath.IsDirWritable() )
|
||||
{
|
||||
savePath = GetMruPath();
|
||||
|
||||
if( !savePath.IsOk() || !savePath.IsDirWritable() )
|
||||
savePath = wxStandardPaths::Get().GetDocumentsDir();
|
||||
}
|
||||
|
||||
wxFileDialog dlg( this, _( "Schematic Files" ), savePath.GetPath(),
|
||||
schematicFileName.GetFullName(), KiCadSchematicFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
||||
if( dlg.ShowModal() == wxID_CANCEL )
|
||||
|
|
|
@ -395,8 +395,17 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
|
|||
orig_name = _( "noname" );
|
||||
}
|
||||
|
||||
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
|
||||
wxFileName fn( pro_dir, orig_name, KiCadPcbFileExtension );
|
||||
wxFileName savePath( Prj().GetProjectFullName() );
|
||||
|
||||
if( !savePath.IsOk() || !savePath.IsDirWritable() )
|
||||
{
|
||||
savePath = GetMruPath();
|
||||
|
||||
if( !savePath.IsOk() || !savePath.IsDirWritable() )
|
||||
savePath = wxStandardPaths::Get().GetDocumentsDir();
|
||||
}
|
||||
|
||||
wxFileName fn( savePath.GetPath(), orig_name, KiCadPcbFileExtension );
|
||||
wxString filename = fn.GetFullPath();
|
||||
|
||||
bool createProject = false;
|
||||
|
|
Loading…
Reference in New Issue