(File sourceDir,
File targetDir)
| 346 | |
| 347 | |
| 348 | static public void copyDirNative(File sourceDir, |
| 349 | File targetDir) throws IOException { |
| 350 | Process process; |
| 351 | if (Platform.isMacOS() || Platform.isLinux()) { |
| 352 | process = Runtime.getRuntime().exec(new String[] { |
| 353 | "cp", "-a", sourceDir.getAbsolutePath(), targetDir.getAbsolutePath() |
| 354 | }); |
| 355 | } else { |
| 356 | // TODO implement version that uses XCOPY here on Windows |
| 357 | throw new RuntimeException("Not yet implemented on Windows"); |
| 358 | } |
| 359 | try { |
| 360 | int result = process.waitFor(); |
| 361 | if (result != 0) { |
| 362 | throw new IOException("Error while copying (result " + result + ")"); |
| 363 | } |
| 364 | } catch (InterruptedException e) { |
| 365 | e.printStackTrace(); |
| 366 | } |
| 367 | } |
| 368 | |
| 369 | |
| 370 | /** |
no test coverage detected