diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..c5f3f6b --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "java.configuration.updateBuildConfiguration": "interactive" +} \ No newline at end of file diff --git a/RepositoryMinerForGit/src/main/java/Test.java b/RepositoryMinerForGit/src/main/java/Test.java index 5af584e..881a4a2 100644 --- a/RepositoryMinerForGit/src/main/java/Test.java +++ b/RepositoryMinerForGit/src/main/java/Test.java @@ -41,7 +41,17 @@ if( git != null ){ //. git clone File project = new File( "./project" ); - git.cloneRepository().setURI( amaryllis_server ).setDirectory( project ).call(); + String filePath = "./project"; + + // フォルダの存在を確認する + if (project.exists()) { + System.out.println("projectフォルダが存在します"); + delete(filePath); + } else { + System.out.println("projectフォルダが存在しません"); + } + + git.cloneRepository().setURI( acanthus_client ).setDirectory( project ).call(); } PlotWalk revWalk = new PlotWalk(repo); @@ -104,4 +114,18 @@ } + public static void delete(String path) { + File filePath = new File(path); + String[] list = filePath.list(); + for(String file : list) { + File f = new File(path + File.separator + file); + if(f.isDirectory()) { + delete(path + File.separator + file); + }else { + f.delete(); + } + } + filePath.delete(); + } + }