|
|
|
@ -403,19 +403,20 @@ public class Dialog {
|
|
|
|
|
}
|
|
|
|
|
modulePath.setText(file.getAbsolutePath());
|
|
|
|
|
|
|
|
|
|
String absolutePath = file.getAbsolutePath();
|
|
|
|
|
|
|
|
|
|
String s = absolutePath.replaceAll(File.separator, "#");
|
|
|
|
|
Pattern compile = Pattern.compile("#project#(.*)#src#main#java#");
|
|
|
|
|
Matcher matcher = compile.matcher(s);
|
|
|
|
|
File api = new File(apiPath.getText());
|
|
|
|
|
if (!matcher.find()) {
|
|
|
|
|
apiPath.setText(new File(api.getParentFile().getAbsolutePath(), "api").getAbsolutePath());
|
|
|
|
|
} else {
|
|
|
|
|
String group = matcher.group(1);
|
|
|
|
|
apiPath.setText(new File(api.getParentFile().getAbsolutePath(), group + "-api").getAbsolutePath());
|
|
|
|
|
String projectName = "";
|
|
|
|
|
// 尝试查找Windows下的项目名称
|
|
|
|
|
String path = file.getAbsolutePath();
|
|
|
|
|
String pathReplace = path.replaceAll("\\\\", "#");
|
|
|
|
|
if (pathReplace.equals(path)) {
|
|
|
|
|
pathReplace = path.replaceAll("/", "#");
|
|
|
|
|
}
|
|
|
|
|
System.out.println(file.getAbsolutePath());
|
|
|
|
|
Pattern compile = Pattern.compile("#([^#]*)#src#main#java#");
|
|
|
|
|
Matcher matcher = compile.matcher(pathReplace);
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
|
projectName = matcher.group(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
apiPath.setText(new File(ProjectManager.getPath(), projectName + "-api").getAbsolutePath());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -514,7 +515,6 @@ public class Dialog {
|
|
|
|
|
} else {
|
|
|
|
|
modulePath.setText(modul.getAbsolutePath());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String projectName = "";
|
|
|
|
|
// 尝试查找Windows下的项目名称
|
|
|
|
|
String path = modul.getAbsolutePath();
|
|
|
|
@ -522,7 +522,7 @@ public class Dialog {
|
|
|
|
|
if (pathReplace.equals(path)) {
|
|
|
|
|
pathReplace = path.replaceAll("/", "#");
|
|
|
|
|
}
|
|
|
|
|
Pattern compile = Pattern.compile("#project#(.*)#src#main#java#");
|
|
|
|
|
Pattern compile = Pattern.compile("#([^#]*)#src#main#java#");
|
|
|
|
|
Matcher matcher = compile.matcher(pathReplace);
|
|
|
|
|
if (matcher.find()) {
|
|
|
|
|
projectName = matcher.group(1);
|
|
|
|
|