mirror of https://github.com/nextcloud/desktop
Return bool from FileSystem::setFileReadOnlyWeak depending on whether permission change was actually made or not
Signed-off-by: Claudio Cambra <claudio.cambra@nextcloud.com>
This commit is contained in:
parent
32145342c8
commit
9811d35a96
|
@ -114,17 +114,17 @@ void FileSystem::setFolderMinimumPermissions(const QString &filename)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
void FileSystem::setFileReadOnlyWeak(const QString &filename, bool readonly)
|
||||
bool FileSystem::setFileReadOnlyWeak(const QString &filename, bool readonly)
|
||||
{
|
||||
QFile file(filename);
|
||||
QFile::Permissions permissions = file.permissions();
|
||||
|
||||
if (!readonly && (permissions & QFile::WriteOwner)) {
|
||||
return; // already writable enough
|
||||
return false; // already writable enough
|
||||
}
|
||||
|
||||
setFileReadOnly(filename, readonly);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FileSystem::rename(const QString &originFileName,
|
||||
|
|
|
@ -65,7 +65,7 @@ namespace FileSystem {
|
|||
* This means that it will preserve explicitly set rw-r--r-- permissions even
|
||||
* when the umask is 0002. (setFileReadOnly() would adjust to rw-rw-r--)
|
||||
*/
|
||||
void OCSYNC_EXPORT setFileReadOnlyWeak(const QString &filename, bool readonly);
|
||||
bool OCSYNC_EXPORT setFileReadOnlyWeak(const QString &filename, bool readonly);
|
||||
|
||||
/**
|
||||
* @brief Try to set permissions so that other users on the local machine can not
|
||||
|
|
Loading…
Reference in New Issue