mirror of https://github.com/rusefi/rusefi.git
only:LuaScriptPanel logging
This commit is contained in:
parent
db2dce6d7a
commit
057eb2e123
|
@ -6,7 +6,7 @@ import java.net.URL;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public interface rusEFIVersion {
|
public interface rusEFIVersion {
|
||||||
int CONSOLE_VERSION = 20240223;
|
int CONSOLE_VERSION = 20240227;
|
||||||
AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||||
|
|
||||||
static long classBuildTimeMillis() {
|
static long classBuildTimeMillis() {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.ui.lua;
|
package com.rusefi.ui.lua;
|
||||||
|
|
||||||
|
import com.devexperts.logging.Logging;
|
||||||
import com.opensr5.ConfigurationImage;
|
import com.opensr5.ConfigurationImage;
|
||||||
import com.rusefi.ConnectionTab;
|
import com.rusefi.ConnectionTab;
|
||||||
import com.rusefi.binaryprotocol.BinaryProtocol;
|
import com.rusefi.binaryprotocol.BinaryProtocol;
|
||||||
|
@ -25,9 +26,12 @@ import java.nio.ByteBuffer;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
|
||||||
|
import static com.devexperts.logging.Logging.getLogging;
|
||||||
import static com.rusefi.ui.util.UiUtils.trueLayout;
|
import static com.rusefi.ui.util.UiUtils.trueLayout;
|
||||||
|
|
||||||
public class LuaScriptPanel {
|
public class LuaScriptPanel {
|
||||||
|
private static final Logging log = getLogging(LuaScriptPanel.class);
|
||||||
|
|
||||||
private static final String SCRIPT_FOLDER_CONFIG_KEY = "SCRIPT_FOLDER";
|
private static final String SCRIPT_FOLDER_CONFIG_KEY = "SCRIPT_FOLDER";
|
||||||
private final UIContext context;
|
private final UIContext context;
|
||||||
private final Node config;
|
private final Node config;
|
||||||
|
@ -158,13 +162,20 @@ public class LuaScriptPanel {
|
||||||
System.out.println("Reading " + fullFileName);
|
System.out.println("Reading " + fullFileName);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String discContent = Files.readString(new File(fullFileName).toPath());
|
File file = new File(fullFileName);
|
||||||
|
log.info("Reloading " + file.getAbsolutePath());
|
||||||
|
String discContent = Files.readString(file.toPath());
|
||||||
|
|
||||||
String newLua = LuaIncludeSyntax.reloadScript(discContent, name -> {
|
String newLua = LuaIncludeSyntax.reloadScript(discContent, name -> {
|
||||||
String includeFullName = getWorkingFolder() + File.separator + name;
|
String includeFullName = getWorkingFolder() + File.separator + name;
|
||||||
|
File includeFile = new File(includeFullName);
|
||||||
|
log.info("Reading " + includeFile.getAbsolutePath());
|
||||||
try {
|
try {
|
||||||
return Files.readString(new File(includeFullName).toPath());
|
String string = Files.readString(includeFile.toPath());
|
||||||
|
log.info("Got " + string.length() + " bytes");
|
||||||
|
return string;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
log.error("ERROR ", e);
|
||||||
return "ERROR reading " + name + ": " + e.getMessage();
|
return "ERROR reading " + name + ": " + e.getMessage();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue