Rusefi Console requires rusefi.ini, which is not present in microrusefi bundle #1172
This commit is contained in:
parent
0865b7be2e
commit
4f2e3e5e61
|
@ -49,7 +49,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
||||||
* @see EngineSnifferPanel
|
* @see EngineSnifferPanel
|
||||||
*/
|
*/
|
||||||
public class Launcher {
|
public class Launcher {
|
||||||
public static final int CONSOLE_VERSION = 20200222;
|
public static final int CONSOLE_VERSION = 20200305;
|
||||||
public static final String INI_FILE_PATH = System.getProperty("ini_file_path", "..");
|
public static final String INI_FILE_PATH = System.getProperty("ini_file_path", "..");
|
||||||
public static final String INPUT_FILES_PATH = System.getProperty("input_files_path", "..");
|
public static final String INPUT_FILES_PATH = System.getProperty("input_files_path", "..");
|
||||||
public static final String TOOLS_PATH = System.getProperty("tools_path", ".");
|
public static final String TOOLS_PATH = System.getProperty("tools_path", ".");
|
||||||
|
|
|
@ -15,6 +15,9 @@ import java.util.ArrayList;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
import static com.rusefi.ui.config.IniFileModel.RUSEFI_INI_PREFIX;
|
||||||
|
import static com.rusefi.ui.config.IniFileModel.RUSEFI_INI_SUFFIX;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see EnumConfigField
|
* @see EnumConfigField
|
||||||
*/
|
*/
|
||||||
|
@ -36,7 +39,7 @@ public class SettingsTab {
|
||||||
final Map<String, DialogModel> dialogs = IniFileModel.getInstance().getDialogs();
|
final Map<String, DialogModel> dialogs = IniFileModel.getInstance().getDialogs();
|
||||||
if (dialogs.isEmpty()) {
|
if (dialogs.isEmpty()) {
|
||||||
content.removeAll();
|
content.removeAll();
|
||||||
content.add(new JLabel("Meta data not found: " + IniFileModel.RUSEFI_INI));
|
content.add(new JLabel("Meta data not found: " + RUSEFI_INI_PREFIX + "*" + RUSEFI_INI_SUFFIX));
|
||||||
UiUtils.trueLayout(content);
|
UiUtils.trueLayout(content);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,9 +14,8 @@ import static com.rusefi.Launcher.INI_FILE_PATH;
|
||||||
* 12/23/2015.
|
* 12/23/2015.
|
||||||
*/
|
*/
|
||||||
public class IniFileModel {
|
public class IniFileModel {
|
||||||
public static final String RUSEFI_INI = "rusefi.ini";
|
public static final String RUSEFI_INI_PREFIX = "rusefi";
|
||||||
// todo: https://sourceforge.net/p/rusefi/tickets/243/
|
public static final String RUSEFI_INI_SUFFIX = ".ini";
|
||||||
private static final String FILENAME = INI_FILE_PATH + File.separator + RUSEFI_INI;
|
|
||||||
|
|
||||||
private final static IniFileModel INSTANCE = new IniFileModel();
|
private final static IniFileModel INSTANCE = new IniFileModel();
|
||||||
private String dialogId;
|
private String dialogId;
|
||||||
|
@ -35,9 +34,12 @@ public class IniFileModel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readIniFile() {
|
private void readIniFile() {
|
||||||
File input = new File(FILENAME);
|
String fileName = findMetaInfoFile();
|
||||||
if (!input.exists()) {
|
File input = null;
|
||||||
System.out.println("No such file: " + FILENAME);
|
if (fileName != null)
|
||||||
|
input = new File(fileName);
|
||||||
|
if (fileName == null || !input.exists()) {
|
||||||
|
System.out.println("No such file: " + RUSEFI_INI_PREFIX + "*" + RUSEFI_INI_SUFFIX);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,6 +53,17 @@ public class IniFileModel {
|
||||||
finishDialog();
|
finishDialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String findMetaInfoFile() {
|
||||||
|
File dir = new File(INI_FILE_PATH);
|
||||||
|
if (!dir.isDirectory())
|
||||||
|
return null;
|
||||||
|
for (String file : dir.list()) {
|
||||||
|
if (file.startsWith(RUSEFI_INI_PREFIX) && file.endsWith(RUSEFI_INI_SUFFIX))
|
||||||
|
return INI_FILE_PATH + File.separator + file;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private void finishDialog() {
|
private void finishDialog() {
|
||||||
if (fieldsOfCurrentDialog.isEmpty())
|
if (fieldsOfCurrentDialog.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue