Skip to content

Commit e728dbf

Browse files
committed
add distinction between LHD/RHD based on file names
File names ending in LHD.txt or RHD.txt will only be used for the respective controllers.
1 parent 8d77a81 commit e728dbf

3 files changed

Lines changed: 20 additions & 14 deletions

File tree

build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<project xmlns:ivy="antlib:org.apache.ivy.ant" name="NAMControllerCompiler" default="dist" basedir=".">
33
<property name="targetversion" value="8" />
4-
<property name="project.version" value="1.3.0" />
4+
<property name="project.version" value="1.3.1" />
55
<property name="MyApp" value="${ant.project.name}" />
66
<property name="MyApp-zipname" value="${ant.project.name}_${project.version}" />
77
<property name="MyApp.jar" value="${MyApp}.jar" />

src/controller/Compiler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ public boolean collectPatterns() {
208208

209209
@Override
210210
public boolean collectRULInputFiles() {
211-
collectRULsTask = CollectRULsTask.getInstance(mode, rulDirs);
211+
collectRULsTask = CollectRULsTask.getInstance(mode, rulDirs, isLHD);
212212
collectRULsTask.execute();
213213
return true;
214214
}

src/controller/tasks/CollectRULsTask.java

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,24 +15,30 @@
1515

1616
public abstract class CollectRULsTask implements ExecutableTask {
1717

18-
private static FileFilter fileFilter = new FileFilter() {
18+
private FileFilter fileFilter = new FileFilter() {
1919
@Override
2020
public boolean accept(File pathname) {
21-
return pathname.isDirectory() ||
22-
pathname.getName().endsWith(".txt") ||
23-
pathname.getName().endsWith(".ini") ||
24-
pathname.getName().endsWith(".rul");
21+
String name = pathname.getName().toLowerCase();
22+
if (pathname.isDirectory()) {
23+
return true;
24+
} else if (name.endsWith(".txt") || name.endsWith(".ini") || name.endsWith(".rul")) {
25+
return isLHD ? !name.contains("rhd.") : !name.contains("lhd.");
26+
} else {
27+
return false;
28+
}
2529
}
2630
};
2731

2832
private final File[] rulDirs;
33+
private final boolean isLHD;
2934

30-
public static CollectRULsTask getInstance(CompileMode mode, File[] rulDirs) {
31-
return mode.isInteractive() ? new GUITask(rulDirs) : new CommandLineTask(rulDirs);
35+
public static CollectRULsTask getInstance(CompileMode mode, File[] rulDirs, boolean isLHD) {
36+
return mode.isInteractive() ? new GUITask(rulDirs, isLHD) : new CommandLineTask(rulDirs, isLHD);
3237
}
3338

34-
private CollectRULsTask(File[] rulDirs) {
39+
private CollectRULsTask(File[] rulDirs, boolean isLHD) {
3540
this.rulDirs = rulDirs;
41+
this.isLHD = isLHD;
3642
}
3743

3844
public abstract Queue<File>[] get() throws InterruptedException, ExecutionException;
@@ -68,8 +74,8 @@ private static class GUITask extends CollectRULsTask {
6874

6975
private final SwingWorker<Queue<File>[], Void> worker;
7076

71-
private GUITask(File[] rulDirs) {
72-
super(rulDirs);
77+
private GUITask(File[] rulDirs, boolean isLHD) {
78+
super(rulDirs, isLHD);
7379
this.worker = new SwingWorker<Queue<File>[], Void>() {
7480

7581
@Override
@@ -94,8 +100,8 @@ private static class CommandLineTask extends CollectRULsTask {
94100

95101
private Queue<File>[] result;
96102

97-
private CommandLineTask(File[] rulDirs) {
98-
super(rulDirs);
103+
private CommandLineTask(File[] rulDirs, boolean isLHD) {
104+
super(rulDirs, isLHD);
99105
}
100106

101107
@Override

0 commit comments

Comments
 (0)