Rusefi Console requires rusefi.ini, which is not present in microrusefi bundle #1172
This commit is contained in:
parent
f93ac0751d
commit
2bc05e6859
|
@ -49,7 +49,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
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 INPUT_FILES_PATH = System.getProperty("input_files_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.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
|
||||
*/
|
||||
|
@ -36,7 +39,7 @@ public class SettingsTab {
|
|||
final Map<String, DialogModel> dialogs = IniFileModel.getInstance().getDialogs();
|
||||
if (dialogs.isEmpty()) {
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -14,9 +14,8 @@ import static com.rusefi.Launcher.INI_FILE_PATH;
|
|||
* 12/23/2015.
|
||||
*/
|
||||
public class IniFileModel {
|
||||
public static final String RUSEFI_INI = "rusefi.ini";
|
||||
// todo: https://sourceforge.net/p/rusefi/tickets/243/
|
||||
private static final String FILENAME = INI_FILE_PATH + File.separator + RUSEFI_INI;
|
||||
public static final String RUSEFI_INI_PREFIX = "rusefi";
|
||||
public static final String RUSEFI_INI_SUFFIX = ".ini";
|
||||
|
||||
private final static IniFileModel INSTANCE = new IniFileModel();
|
||||
private String dialogId;
|
||||
|
@ -35,9 +34,12 @@ public class IniFileModel {
|
|||
}
|
||||
|
||||
private void readIniFile() {
|
||||
File input = new File(FILENAME);
|
||||
if (!input.exists()) {
|
||||
System.out.println("No such file: " + FILENAME);
|
||||
String fileName = findMetaInfoFile();
|
||||
File input = null;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -51,6 +53,17 @@ public class IniFileModel {
|
|||
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() {
|
||||
if (fieldsOfCurrentDialog.isEmpty())
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue