Browse Source

Allow write access to all files if a user has effective root permissions on linux

tags/2021-05-28
hogliux 9 years ago
parent
commit
16fde6798b
1 changed files with 11 additions and 1 deletions
  1. +11
    -1
      modules/juce_core/native/juce_posix_SharedCode.h

+ 11
- 1
modules/juce_core/native/juce_posix_SharedCode.h View File

@@ -332,11 +332,21 @@ uint64 File::getFileIdentifier() const
return juce_stat (fullPath, info) ? (uint64) info.st_ino : 0;
}
static bool hasEffectiveRootFilePermissions()
{
#if JUCE_LINUX
return (geteuid() == 0);
#else
return false;
#endif
}
//==============================================================================
bool File::hasWriteAccess() const
{
if (exists())
return access (fullPath.toUTF8(), W_OK) == 0;
return (hasEffectiveRootFilePermissions()
|| access (fullPath.toUTF8(), W_OK) == 0);
if ((! isDirectory()) && fullPath.containsChar (separator))
return getParentDirectory().hasWriteAccess();


Loading…
Cancel
Save