Skip to content

Commit

Permalink
Updated to be non-posix compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
gurpreet- committed Aug 6, 2019
1 parent 323fb9c commit 8a2019a
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions src/main/java/co/libly/hydride/utils/LibraryLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -292,21 +292,26 @@ static File createTempDirectory() {
return hydrideDirectory;
}

private void setPermissions(File file) throws IOException{
Set<PosixFilePermission> perms = new HashSet<>();
perms.add(PosixFilePermission.OWNER_READ);
perms.add(PosixFilePermission.OWNER_WRITE);
perms.add(PosixFilePermission.OWNER_EXECUTE);

perms.add(PosixFilePermission.OTHERS_READ);
perms.add(PosixFilePermission.OTHERS_WRITE);
perms.add(PosixFilePermission.OTHERS_EXECUTE);

perms.add(PosixFilePermission.GROUP_READ);
perms.add(PosixFilePermission.GROUP_WRITE);
perms.add(PosixFilePermission.GROUP_EXECUTE);

Files.setPosixFilePermissions(file.toPath(), perms);
private void setPermissions(File file) throws IOException {
if (isPosixCompliant()) {
Set<PosixFilePermission> perms = new HashSet<>();
perms.add(PosixFilePermission.OWNER_READ);
perms.add(PosixFilePermission.OWNER_WRITE);
perms.add(PosixFilePermission.OWNER_EXECUTE);

perms.add(PosixFilePermission.OTHERS_READ);
perms.add(PosixFilePermission.OTHERS_WRITE);
perms.add(PosixFilePermission.OTHERS_EXECUTE);

perms.add(PosixFilePermission.GROUP_READ);
perms.add(PosixFilePermission.GROUP_WRITE);
perms.add(PosixFilePermission.GROUP_EXECUTE);
Files.setPosixFilePermissions(file.toPath(), perms);
} else {
file.setWritable(true);
file.setReadable(true);
file.setExecutable(true);
}
}

/**
Expand Down

0 comments on commit 8a2019a

Please sign in to comment.