From f852cd603d45f3bad87b6d550141ea382997a05f Mon Sep 17 00:00:00 2001 From: Shane Kilkelly Date: Thu, 29 Nov 2018 11:39:30 +0000 Subject: [PATCH] Use FileUtils to handle copying of migrated repository --- .../wlgitbridge/bridge/repo/FSGitRepoStore.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/FSGitRepoStore.java b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/FSGitRepoStore.java index d32bb423fe..9e13e85668 100644 --- a/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/FSGitRepoStore.java +++ b/services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/FSGitRepoStore.java @@ -89,18 +89,12 @@ public class FSGitRepoStore implements RepoStore { sourcePath, destinationPath ); - new ProcessBuilder( - "rm", "-rf", - destinationPath - ).start(); - Process copyProcess = new ProcessBuilder( - "cp", "-ra", - sourcePath, - destinationPath + "/" - ).start(); try { - copyProcess.waitFor(); - } catch (InterruptedException e) { + File source = new File(sourcePath); + File destination = new File(destinationPath); + FileUtils.deleteDirectory(destination); + FileUtils.copyDirectory(source, destination); + } catch (Exception e) { e.printStackTrace(); throw new IOException("copy failed" + e.getLocalizedMessage()); }