Skip to content

Commit ad7dae4

Browse files
fix(Windows): set Nextcloud folder attribute as read only (rather than system)
closes #5265 Signed-off-by: nofish <[email protected]>
1 parent 95944c5 commit ad7dae4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/common/utility_win.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ void Utility::setupDesktopIni(const QString &folder, const QString localizedReso
146146
desktopIni.write("\r\n");
147147
desktopIni.close();
148148

149-
// Set the folder as system and Desktop.ini as hidden+system for explorer to pick it.
149+
// Set the folder as read only and Desktop.ini as hidden+system for explorer to pick it.
150150
// https://msdn.microsoft.com/en-us/library/windows/desktop/cc144102
151151
DWORD folderAttrs = GetFileAttributesW((wchar_t *)folder.utf16());
152-
SetFileAttributesW((wchar_t *)folder.utf16(), folderAttrs | FILE_ATTRIBUTE_SYSTEM);
152+
SetFileAttributesW((wchar_t *)folder.utf16(), folderAttrs | FILE_ATTRIBUTE_READONLY);
153153
SetFileAttributesW((wchar_t *)desktopIni.fileName().utf16(), FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM);
154154
}
155155

@@ -234,8 +234,8 @@ void Utility::removeFavLink(const QString &folder)
234234

235235
// #2 Remove the system file attribute
236236
const auto folderAttrs = GetFileAttributesW(folder.toStdWString().c_str());
237-
if (!SetFileAttributesW(folder.toStdWString().c_str(), folderAttrs & ~FILE_ATTRIBUTE_SYSTEM)) {
238-
qCWarning(lcUtility) << "Remove system file attribute failed for:" << folder;
237+
if (!SetFileAttributesW(folder.toStdWString().c_str(), folderAttrs & ~FILE_ATTRIBUTE_READONLY)) {
238+
qCWarning(lcUtility) << "Remove read only file attribute failed for:" << folder;
239239
}
240240

241241
// #3 Remove the link to this folder

0 commit comments

Comments
 (0)