Просмотр исходного кода

Use FileUtils to handle copying of migrated repository

Shane Kilkelly 7 лет назад
Родитель
Сommit
f852cd603d

+ 5 - 11
services/git-bridge/src/main/java/uk/ac/ic/wlgitbridge/bridge/repo/FSGitRepoStore.java

@@ -89,18 +89,12 @@ public class FSGitRepoStore implements RepoStore {
              sourcePath,
              sourcePath,
              destinationPath
              destinationPath
          );
          );
-         new ProcessBuilder(
-                 "rm", "-rf",
-                 destinationPath
-         ).start();
-         Process copyProcess = new ProcessBuilder(
-                 "cp", "-ra",
-                 sourcePath,
-                 destinationPath + "/"
-         ).start();
          try {
          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();
              e.printStackTrace();
              throw new IOException("copy failed" + e.getLocalizedMessage());
              throw new IOException("copy failed" + e.getLocalizedMessage());
          }
          }