@Test public void testMkdir() throws Exception { File directory = new File(temp.getRoot(), "newdir"); ShellCommandUtil.Result result = ShellCommandUtil.mkdir(directory.getAbsolutePath(), false); Assert.assertTrue(result.isSuccessful()); Assert.assertTrue(directory.exists()); }
public static Result mkdir(String directoryPath, boolean sudo) throws IOException, InterruptedException { if (pathExists(directoryPath, sudo).isSuccessful()) { return new Result(0, "The directory already exists, skipping.", ""); } else { ArrayList<String> command = new ArrayList<String>(); command.add("/bin/mkdir"); if (!WINDOWS) { command.add("-p"); } command.add(directoryPath); return runCommand(command, null, null, sudo); } }
ShellCommandUtil { public static Result mkdir(String directoryPath, boolean sudo) throws IOException, InterruptedException { if (pathExists(directoryPath, sudo).isSuccessful()) { return new Result(0, "The directory already exists, skipping.", ""); } else { ArrayList<String> command = new ArrayList<String>(); command.add("/bin/mkdir"); if (!WINDOWS) { command.add("-p"); } command.add(directoryPath); return runCommand(command, null, null, sudo); } } }
ShellCommandUtil { public static Result mkdir(String directoryPath, boolean sudo) throws IOException, InterruptedException { if (pathExists(directoryPath, sudo).isSuccessful()) { return new Result(0, "The directory already exists, skipping.", ""); } else { ArrayList<String> command = new ArrayList<String>(); command.add("/bin/mkdir"); if (!WINDOWS) { command.add("-p"); } command.add(directoryPath); return runCommand(command, null, null, sudo); } }  }
ShellCommandUtil { public static Result mkdir(String directoryPath, boolean sudo) throws IOException, InterruptedException { if (pathExists(directoryPath, sudo).isSuccessful()) { return new Result(0, "The directory already exists, skipping.", ""); } else { ArrayList<String> command = new ArrayList<String>(); command.add("/bin/mkdir"); if (!WINDOWS) { command.add("-p"); } command.add(directoryPath); return runCommand(command, null, null, sudo); } }  static void logOpenSslExitCode(String command, int exitCode); static String hideOpenSslPassword(String command); static String getOpenSslCommandResult(String command, int exitCode); static String getUnixFilePermissions(String path); static void setUnixFilePermissions(String mode, String path); static Result setFileOwner(String path, String ownerName); static Result setFileGroup(String path,  String groupName); static Result setFileMode(String path,
                                   boolean ownerReadable, boolean ownerWritable, boolean ownerExecutable,
                                   boolean groupReadable, boolean groupWritable, boolean groupExecutable,
                                   boolean otherReadable, boolean otherWritable, boolean otherExecutable); static Result pathExists(String path, boolean sudo); static Result mkdir(String directoryPath, boolean sudo); static Result copyFile(String srcFile, String destFile, boolean force, boolean sudo); static Result delete(String file, boolean force, boolean sudo); static Result runCommand(List<String> args, Map<String, String> vars, InteractiveHandler interactiveHandler, boolean sudo); static Result runCommand(String[] args, Map<String, String> vars, InteractiveHandler interactiveHandler, boolean sudo); static Result runCommand(String[] args, Map<String, String> vars); static Result runCommand(String[] args); }
ShellCommandUtil { public static Result mkdir(String directoryPath, boolean sudo) throws IOException, InterruptedException { if (pathExists(directoryPath, sudo).isSuccessful()) { return new Result(0, "The directory already exists, skipping.", ""); } else { ArrayList<String> command = new ArrayList<String>(); command.add("/bin/mkdir"); if (!WINDOWS) { command.add("-p"); } command.add(directoryPath); return runCommand(command, null, null, sudo); } }  static void logOpenSslExitCode(String command, int exitCode); static String hideOpenSslPassword(String command); static String getOpenSslCommandResult(String command, int exitCode); static String getUnixFilePermissions(String path); static void setUnixFilePermissions(String mode, String path); static Result setFileOwner(String path, String ownerName); static Result setFileGroup(String path,  String groupName); static Result setFileMode(String path,
                                   boolean ownerReadable, boolean ownerWritable, boolean ownerExecutable,
                                   boolean groupReadable, boolean groupWritable, boolean groupExecutable,
                                   boolean otherReadable, boolean otherWritable, boolean otherExecutable); static Result pathExists(String path, boolean sudo); static Result mkdir(String directoryPath, boolean sudo); static Result copyFile(String srcFile, String destFile, boolean force, boolean sudo); static Result delete(String file, boolean force, boolean sudo); static Result runCommand(List<String> args, Map<String, String> vars, InteractiveHandler interactiveHandler, boolean sudo); static Result runCommand(String[] args, Map<String, String> vars, InteractiveHandler interactiveHandler, boolean sudo); static Result runCommand(String[] args, Map<String, String> vars); static Result runCommand(String[] args); static final boolean WINDOWS; static final boolean LINUX; static final boolean MAC; static final boolean UNIX_LIKE; static final String MASK_OWNER_ONLY_RW; static final String MASK_OWNER_ONLY_RWX; static final String MASK_EVERYBODY_RWX; }