(File sourceDir,
File targetDir)
| 259 | |
| 260 | |
| 261 | static public void copyDirNative(File sourceDir, |
| 262 | File targetDir) throws IOException { |
| 263 | Process process = null; |
| 264 | if (Platform.isMacOS() || Platform.isLinux()) { |
| 265 | process = Runtime.getRuntime().exec(new String[] { |
| 266 | "cp", "-a", sourceDir.getAbsolutePath(), targetDir.getAbsolutePath() |
| 267 | }); |
| 268 | } else { |
| 269 | // TODO implement version that uses XCOPY here on Windows |
| 270 | throw new RuntimeException("Not yet implemented on Windows"); |
| 271 | } |
| 272 | try { |
| 273 | int result = process.waitFor(); |
| 274 | if (result != 0) { |
| 275 | throw new IOException("Error while copying (result " + result + ")"); |
| 276 | } |
| 277 | } catch (InterruptedException e) { |
| 278 | e.printStackTrace(); |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | |
| 283 | // /** |
no test coverage detected