Search in sources :

Example 1 with FilePermissions

use of com.mucommander.commons.file.FilePermissions in project mucommander by mucommander.

the class RWArchiveEntryFile method changePermissions.

@Override
public void changePermissions(int permissions) throws IOException {
    if (!entry.exists())
        throw new IOException();
    FilePermissions oldPermissions = entry.getPermissions();
    FilePermissions newPermissions = new SimpleFilePermissions(permissions, oldPermissions.getMask());
    entry.setPermissions(newPermissions);
    boolean success = updateEntryAttributes();
    if (// restore old permissions if attributes could not be updated
    !success)
        entry.setPermissions(oldPermissions);
    if (!success)
        throw new IOException();
}
Also used : FilePermissions(com.mucommander.commons.file.FilePermissions) SimpleFilePermissions(com.mucommander.commons.file.SimpleFilePermissions) IOException(java.io.IOException) SimpleFilePermissions(com.mucommander.commons.file.SimpleFilePermissions)

Aggregations

FilePermissions (com.mucommander.commons.file.FilePermissions)1 SimpleFilePermissions (com.mucommander.commons.file.SimpleFilePermissions)1 IOException (java.io.IOException)1