| 131 | |
| 132 | |
| 133 | protected boolean delete(Path tempBuildFolder) throws IOException { |
| 134 | if (!file.delete()) { |
| 135 | return false; |
| 136 | } |
| 137 | |
| 138 | List<Path> tempBuildFolders = Stream.of(tempBuildFolder, tempBuildFolder.resolve("sketch")) |
| 139 | .filter(path -> Files.exists(path)).collect(Collectors.toList()); |
| 140 | |
| 141 | for (Path folder : tempBuildFolders) { |
| 142 | if (!deleteCompiledFilesFrom(folder)) { |
| 143 | return false; |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | sketch.removeFile(this); |
| 148 | |
| 149 | return true; |
| 150 | } |
| 151 | |
| 152 | private boolean deleteCompiledFilesFrom(Path tempBuildFolder) throws IOException { |
| 153 | List<Path> compiledFiles = Files.list(tempBuildFolder) |