Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected JavaParameters createJavaParameters() {

//copy to project folder, and then user is able to update server.xml under the project.
Path projectConfPath = Paths.get(project.getBasePath(), ".smarttomcat", module.getName(), "conf");
if (!projectConfPath.toFile().exists()) {
if (!projectConfPath.toFile().exists() || PluginUtils.isEmptyFolder(projectConfPath)) {
FileUtil.createDirectory(projectConfPath.toFile());
FileUtil.copyDir(tomcatInstallationPath.resolve("conf").toFile(), projectConfPath.toFile());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,22 @@ public static List<Module> getModules(Project project) {

return ModuleUtilCore.findModuleForFile(virtualFile, project);
}

/**
* Checks if the given folder is empty.
*
* @param path the path to the folder
* @return {@code true} if the folder exists and is empty, {@code false} otherwise
* @throws IOException if an I/O error occurs
*/

public static boolean isEmptyFolder(Path path) throws IOException {
if (Files.isDirectory(path)) {
try (Stream<Path> entries = Files.list(path)) {
return !entries.findFirst().isPresent();
}
}
return false;
}

}