setFileExecutablePermission static method

void setFileExecutablePermission(
  1. File file,
  2. bool executable
)

Implementation

static void setFileExecutablePermission(File file, bool executable) {
  if (file.path.endsWith('.dart')) return;

  if (Platform.isLinux || Platform.isMacOS) {
    var mode = executable ? '+rx' : '-rx';
    var chmodPath = whichExecutablePath('chmod');
    Process.runSync(chmodPath, [mode, file.path]);
  }
}