稳定版本备份

This commit is contained in:
2025-08-25 15:53:05 +08:00
parent 53178ddd9a
commit aae60af637
53 changed files with 1197 additions and 1612 deletions
+24
View File
@@ -0,0 +1,24 @@
#include <fileManager.h>
#include <Windows.h>
bool fileManager::setFileReadOnly(const std::string& filePath, bool readOnly) {
DWORD attributes = GetFileAttributes(filePath.c_str());
if (attributes == INVALID_FILE_ATTRIBUTES) {
std::cerr << "Error getting file attributes: " << GetLastError() << std::endl;
return false;
}
if (readOnly) {
attributes |= FILE_ATTRIBUTE_READONLY;
}
else {
attributes &= ~FILE_ATTRIBUTE_READONLY;
}
if (!SetFileAttributes(filePath.c_str(), attributes)) {
std::cerr << "Error setting file attributes: " << GetLastError() << std::endl;
return false;
}
return true;
}