| 73 | } |
| 74 | |
| 75 | public static void moveMapper(Path targetPath) { |
| 76 | try { |
| 77 | Path mapperPath = targetPath.resolve("mapper"); |
| 78 | File mapperDir = mapperPath.toFile(); |
| 79 | mapperDir.mkdir(); |
| 80 | File file = targetPath.toFile(); |
| 81 | if (file.isDirectory()) { |
| 82 | try (Stream<Path> walk = Files.walk(targetPath)) { |
| 83 | walk.filter(path -> path.toFile().getName().endsWith("Dao.xml") || path.toFile().getName().endsWith("Mapper.xml")) |
| 84 | .forEach(path -> { |
| 85 | try { |
| 86 | Path newPath = mapperPath.resolve(path.toFile().getName()); |
| 87 | String filename = path.toFile().getName(); |
| 88 | StringBuilder prefix = new StringBuilder(); |
| 89 | int count = 0; |
| 90 | while (newPath.toFile().exists() && count < 2) { |
| 91 | prefix.append("_"); |
| 92 | count++; |
| 93 | newPath = mapperPath.resolve(prefix + filename); |
| 94 | } |
| 95 | Files.copy(path, newPath); |
| 96 | } catch (FileAlreadyExistsException e) { |
| 97 | |
| 98 | } catch (Exception e) { |
| 99 | logger.warn(e); |
| 100 | } |
| 101 | }); |
| 102 | } catch (IOException e) { |
| 103 | logger.warn("Failed to walk directory {} due to {}", targetPath, e); |
| 104 | } |
| 105 | } |
| 106 | } catch (Exception e) { |
| 107 | e.printStackTrace(); |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | public static void unsafeMoveClasses(Path targetPath) { |
| 112 | List<String> root = tlds; |