Check for read permissions before trying to import schematic file

This will display a better error message to the user, instead of saying
that no plugins to load the file are found (because the plugin tests
will also fail due to being unable to read the file).
This commit is contained in:
Ian McInerney 2024-02-16 11:37:11 +00:00 committed by Ian McInerney
parent 87a8235831
commit e67eae90e9
1 changed files with 6 additions and 0 deletions

View File

@ -758,6 +758,12 @@ void SCH_EDIT_FRAME::OnImportProject( wxCommandEvent& aEvent )
wxFileName fn = dlg.GetPath();
if( !fn.IsFileReadable() )
{
wxLogError( _( "Insufficient permissions to read file '%s'." ), fn.GetFullPath() );
return;
}
SCH_IO_MGR::SCH_FILE_T pluginType = SCH_IO_MGR::SCH_FILE_T::SCH_FILE_UNKNOWN;
for( const SCH_IO_MGR::SCH_FILE_T& fileType : SCH_IO_MGR::SCH_FILE_T_vector )