Fix an issue in IDM_EDIT_CLEARREADONLY

Using ^= for the readonly attribute will cause it to always change the bit.  So if CLEARREADONLY is called on a file that isn't read only, the file will become read only.

Fix #5768, close #5774
This commit is contained in:
briddums 2019-06-10 12:38:10 -07:00 committed by Don HO
parent 6d3606074a
commit fa254e579c
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -1568,7 +1568,7 @@ void Notepad_plus::command(int id)
Buffer * buf = _pEditView->getCurrentBuffer();
DWORD dwFileAttribs = ::GetFileAttributes(buf->getFullPathName());
dwFileAttribs ^= FILE_ATTRIBUTE_READONLY;
dwFileAttribs &= ~FILE_ATTRIBUTE_READONLY;
::SetFileAttributes(buf->getFullPathName(), dwFileAttribs);
buf->setFileReadOnly(false);