Skip to content

Commit 5879b31

Browse files
committed
更新脚本
1 parent 3056119 commit 5879b31

1 file changed

Lines changed: 26 additions & 6 deletions

File tree

src/test/java/com/xwintop/xJavaFxTool/javafx/PluginProgectBuildTool.java

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.xwintop.xJavaFxTool.javafx;
22

3+
import cn.hutool.core.text.UnicodeUtil;
4+
import cn.hutool.core.util.EscapeUtil;
35
import org.apache.commons.io.FileUtils;
46
import org.apache.commons.io.FilenameUtils;
57
import org.junit.Test;
@@ -17,14 +19,14 @@ public class PluginProgectBuildTool {
1719
private String projectPath = "C:/IDEA/xwintop/xJavaFxTool/src/main/";
1820
// private String projectPath = "";
1921
private String resources = "resources/com/xwintop/xJavaFxTool/";
20-
// private String xmlPath = "assistTools/";
22+
// private String xmlPath = "assistTools/";
2123
// private String xmlPath = "codeTools/";
2224
// private String xmlPath = "debugTools/";
2325
// private String xmlPath = "developTools/";
2426
// private String xmlPath = "epmsTools/";
25-
// private String xmlPath = "games/";
26-
// private String xmlPath = "littleTools/";
27-
private String xmlPath = "webTools/";
27+
// private String xmlPath = "games/";
28+
private String xmlPath = "littleTools/";
29+
// private String xmlPath = "webTools/";
2830
private String srcPath = "java/com/xwintop/xJavaFxTool/";
2931

3032
private String pluginPath = "C:/IDEA/xJavaFxTool-plugin/";
@@ -68,14 +70,15 @@ public void buildJava() throws Exception {
6870

6971
@Test
7072
public void buildJson() throws Exception {
73+
// System.out.println(UnicodeUtil.toUnicode("测试",true));
7174
File[] fxmlFileList = new File(projectPath + resources + "fxmlView/" + xmlPath).listFiles();
7275
for (File file : fxmlFileList) {
73-
if (file.isDirectory()) {
76+
if (file.isDirectory() || !file.getName().endsWith(".fxml")) {
7477
continue;
7578
}
7679
String pluginProgectName = FilenameUtils.getBaseName(file.getName());
7780
String pluginProgectPath = pluginPath + xmlPath + "x-" + pluginProgectName;
78-
System.out.println(PluginProgectPomBuildTool.getPluginList_Json(pluginProgectName,xmlPath));
81+
System.out.println(PluginProgectPomBuildTool.getPluginList_Json(pluginProgectName, xmlPath));
7982
// System.out.println("cd " + pluginProgectPath + "\n mvn package");
8083
File pluginLibsJarFile = new File(pluginProgectPath + "/target/x-" + pluginProgectName + "-0.0.1.jar");
8184
if (pluginLibsJarFile.exists()) {
@@ -86,6 +89,23 @@ public void buildJson() throws Exception {
8689
}
8790
}
8891

92+
@Test
93+
public void buildChangeFileUnicode() throws Exception {
94+
File[] fxmlFileList = new File(projectPath + resources + "fxmlView/" + xmlPath).listFiles();
95+
for (File file : fxmlFileList) {
96+
if (file.isDirectory()) {
97+
continue;
98+
}
99+
String pluginProgectName = FilenameUtils.getBaseName(file.getName());
100+
String pluginProgectPath = pluginPath + xmlPath + "x-" + pluginProgectName;
101+
pluginProgectPath = pluginProgectPath + "/src/main/";
102+
103+
File localeFile = new File(pluginProgectPath + "resources/locale/" + pluginProgectName + ".properties");
104+
FileUtils.writeStringToFile(localeFile, UnicodeUtil.toUnicode(FileUtils.readFileToString(localeFile, "utf-8")));
105+
// break;
106+
}
107+
}
108+
89109
private void copyPluginFile(String path, String pluginProgectPath) {
90110
try {
91111
File fromFile = new File(projectPath + path);

0 commit comments

Comments
 (0)