Respect symlinks for the config file
This commit is contained in:
@@ -255,7 +255,7 @@ public class RuneLite
|
|||||||
.withRequiredArg()
|
.withRequiredArg()
|
||||||
.ofType(ClientUpdateCheckMode.class)
|
.ofType(ClientUpdateCheckMode.class)
|
||||||
.defaultsTo(ClientUpdateCheckMode.AUTO)
|
.defaultsTo(ClientUpdateCheckMode.AUTO)
|
||||||
.withValuesConvertedBy(new EnumConverter<ClientUpdateCheckMode>(ClientUpdateCheckMode.class)
|
.withValuesConvertedBy(new EnumConverter<>(ClientUpdateCheckMode.class)
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public ClientUpdateCheckMode convert(String v)
|
public ClientUpdateCheckMode convert(String v)
|
||||||
@@ -326,8 +326,9 @@ public class RuneLite
|
|||||||
System.setProperty("cli.world", String.valueOf(world));
|
System.setProperty("cli.world", String.valueOf(world));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final File configFile = resolveLinks(options.valueOf(configfile));
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
try (FileInputStream in = new FileInputStream(RuneLite.RUNELITE_DIR + "\\runeliteplus.properties"))
|
try (FileInputStream in = new FileInputStream(configFile))
|
||||||
{
|
{
|
||||||
properties.load(new InputStreamReader(in, StandardCharsets.UTF_8));
|
properties.load(new InputStreamReader(in, StandardCharsets.UTF_8));
|
||||||
try
|
try
|
||||||
@@ -402,7 +403,7 @@ public class RuneLite
|
|||||||
injector = Guice.createInjector(new RuneLiteModule(
|
injector = Guice.createInjector(new RuneLiteModule(
|
||||||
clientLoader,
|
clientLoader,
|
||||||
options.has("safe-mode"),
|
options.has("safe-mode"),
|
||||||
options.valueOf(configfile)));
|
configFile));
|
||||||
|
|
||||||
injector.getInstance(RuneLite.class).start();
|
injector.getInstance(RuneLite.class).start();
|
||||||
final long end = System.currentTimeMillis();
|
final long end = System.currentTimeMillis();
|
||||||
@@ -644,4 +645,16 @@ public class RuneLite
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static File resolveLinks(File f)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return f.toPath().toRealPath().toFile();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user