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

17
LINES

< > BotCompany Repo | #1006751 // makeExecutable_java7

JavaX fragment (include)

import java.nio.file.Paths;
import java.nio.file.Files;
import java.nio.file.attribute.PosixFilePermission;

// requires Java 7
// assumes the file is yours
static void makeExecutable_java7(File file) ctex {
  if (isWindows()) ret;
  Set<PosixFilePermission> p = new HashSet<PosixFilePermission>(Files.getPosixFilePermissions(file.toPath()));
  p.add(PosixFilePermission.OWNER_READ);
  p.add(PosixFilePermission.OWNER_EXECUTE);
  p.add(PosixFilePermission.GROUP_READ);
  p.add(PosixFilePermission.GROUP_EXECUTE);
  p.add(PosixFilePermission.OTHERS_READ);
  p.add(PosixFilePermission.OTHERS_EXECUTE);
  Files.setPosixFilePermissions(file.toPath(), p);
}

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: 485 / 511
Version history: 3 change(s)
Referenced in: [show references]