diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index 9b981d2bef..8b5934e4fd 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -222,7 +222,10 @@ bool EDA_DRAW_FRAME::LockFile( const wxString& aFileName ) m_file_checker = std::make_unique( aFileName ); - return m_file_checker->Locked(); + // If the file is not valid, or is successfully locked, return true + // Invalid lockfiles are the result of bad permissions, so this is + // likely not a file that we can override regardless + return !m_file_checker->Valid() || m_file_checker->Locked(); } diff --git a/include/lockfile.h b/include/lockfile.h index 99a8328b67..b1cf12a97c 100644 --- a/include/lockfile.h +++ b/include/lockfile.h @@ -52,6 +52,13 @@ public: fn.SetName( "~" + fn.GetName() ); fn.SetExt( fn.GetExt() + ".lck" ); + if( !fn.IsFileWritable() ) + { + m_status = true; + m_removeOnRelease = false; + return; + } + m_lockFilename = fn.GetFullPath(); wxFile file;