@@ -59,8 +59,13 @@ public final class HMCLGameLauncher extends DefaultLauncher {
|
|||||||
|
|
||||||
private void generateOptionsTxt() {
|
private void generateOptionsTxt() {
|
||||||
File optionsFile = new File(repository.getRunDirectory(version.getId()), "options.txt");
|
File optionsFile = new File(repository.getRunDirectory(version.getId()), "options.txt");
|
||||||
|
File configFolder = new File(repository.getRunDirectory(version.getId()), "config");
|
||||||
|
|
||||||
if (optionsFile.exists())
|
if (optionsFile.exists())
|
||||||
return;
|
return;
|
||||||
|
if (configFolder.isDirectory())
|
||||||
|
if (findFiles(configFolder, "options.txt"))
|
||||||
|
return;
|
||||||
try {
|
try {
|
||||||
// TODO: Dirty implementation here
|
// TODO: Dirty implementation here
|
||||||
if (I18n.getCurrentLocale().getLocale() == Locale.CHINA)
|
if (I18n.getCurrentLocale().getLocale() == Locale.CHINA)
|
||||||
@@ -70,6 +75,20 @@ public final class HMCLGameLauncher extends DefaultLauncher {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean findFiles(File folder, String fileName) {
|
||||||
|
File[] fs = folder.listFiles();
|
||||||
|
if (fs != null) {
|
||||||
|
for (File f : fs) {
|
||||||
|
if (f.isDirectory())
|
||||||
|
if (f.listFiles((dir, name) -> name.equals(fileName)) != null)
|
||||||
|
return true;
|
||||||
|
if (f.getName().equals(fileName))
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ManagedProcess launch() throws IOException, InterruptedException {
|
public ManagedProcess launch() throws IOException, InterruptedException {
|
||||||
generateOptionsTxt();
|
generateOptionsTxt();
|
||||||
|
|||||||
Reference in New Issue
Block a user