Feature request: Create files with write access for everyone


#1

Is it possible with JUCE to write a file to disk that has write access set for everyone on the system? I couldn’t figure out how. Below I assume it’s not possible.

File::setReadOnly (false)

will make a file writable for the current user, but not for other users. When creating a file in

File::SpecialLocationType::commonDocumentsDirectory

it should be writable for everyone. Almost all other applications on my main development machine (macOS) writing to this directory write their files with write access for everyone.

According to the comment in juce_core/native/juce_posix_SharedCode.h

bool File::setFileReadOnlyInternal (bool shouldBeReadOnly) const
{
    // Hmm.. should we give global write permission or just the current user?
    return setFileModeFlags (fullPath, S_IWUSR | S_IWGRP | S_IWOTH, ! shouldBeReadOnly);
}

the current behaviour is open for discussion.

Feature request
Could an additional optional parameter be added to File::setReadOnly() to make it possible to create a file with write access for everyone? E.g.

setReadOnly (bool shouldBeReadOnly, bool applyRecursively=false, bool forAllUsers=false)