From e67eae90e965dc29eb56ac7fafd7742220a3c16d Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Fri, 16 Feb 2024 11:37:11 +0000 Subject: [PATCH] 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). --- eeschema/files-io.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eeschema/files-io.cpp b/eeschema/files-io.cpp index 2c37dd15f6..cf2397a5c3 100644 --- a/eeschema/files-io.cpp +++ b/eeschema/files-io.cpp @@ -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 )