Special configuration file for the simulation can be set
This commit is contained in:
@@ -88,8 +88,24 @@ public class WS2812Simulation implements LuaSimulation {
|
||||
if (args.length >= 2) {
|
||||
simu.setWS2812Layout(new File(args[1]));
|
||||
}
|
||||
|
||||
simu.callScript(f.getName());
|
||||
try {
|
||||
if (args.length >= 3) {
|
||||
File additionalFile = new File(args[2]);
|
||||
if (additionalFile.exists() && (simu.doFile != null)) {
|
||||
|
||||
Files.copy(additionalFile.toPath(),
|
||||
new File(simu.doFile.getWorkingDirectory() + File.separator + additionalFile.getName()).toPath());
|
||||
System.out.println("Integrate " + additionalFile.getName() + " into simulation");
|
||||
} else {
|
||||
System.err.println("Script " + args[2] + " cannot be found");
|
||||
System.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
simu.callScript(f.getName());
|
||||
} catch (IOException e) {
|
||||
System.err.println("[Nodemcu] " + e.getMessage());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
printUsage();
|
||||
|
@@ -43,4 +43,12 @@ public class DoFileFunction extends OneArgFunction {
|
||||
this.workingDir = workingDir;
|
||||
}
|
||||
|
||||
public String getWorkingDirectory() {
|
||||
if (workingDir != null) {
|
||||
return workingDir.getAbsolutePath();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -172,7 +172,7 @@ public class WS2812Layout extends JFrame {
|
||||
} else {
|
||||
sb.append("" + this.getText());
|
||||
}
|
||||
sb.append(Integer.toHexString(this.getForeground().getRed()) +
|
||||
sb.append("|" + Integer.toHexString(this.getForeground().getRed()) +
|
||||
" " + Integer.toHexString(this.getForeground().getGreen()) +
|
||||
" " + Integer.toHexString(this.getForeground().getBlue()));
|
||||
|
||||
|
Reference in New Issue
Block a user