Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #1006751 // makeExecutable_java7

JavaX fragment (include)

1  
import java.nio.file.Paths;
2  
import java.nio.file.Files;
3  
import java.nio.file.attribute.PosixFilePermission;
4  
5  
// requires Java 7
6  
// assumes the file is yours
7  
static void makeExecutable_java7(File file) ctex {
8  
  if (isWindows()) ret;
9  
  Set<PosixFilePermission> p = new HashSet<PosixFilePermission>(Files.getPosixFilePermissions(file.toPath()));
10  
  p.add(PosixFilePermission.OWNER_READ);
11  
  p.add(PosixFilePermission.OWNER_EXECUTE);
12  
  p.add(PosixFilePermission.GROUP_READ);
13  
  p.add(PosixFilePermission.GROUP_EXECUTE);
14  
  p.add(PosixFilePermission.OTHERS_READ);
15  
  p.add(PosixFilePermission.OTHERS_EXECUTE);
16  
  Files.setPosixFilePermissions(file.toPath(), p);
17  
}

Author comment

Began life as a copy of #1001504

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1006751
Snippet name: makeExecutable_java7
Eternal ID of this version: #1006751/4
Text MD5: b4f628b22de8d6054a30bd8ffd42ea0c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-06-30 23:14:25
Source code size: 668 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 486 / 513
Version history: 3 change(s)
Referenced in: [show references]