Console: Fix /configclients help message for split client config files

This commit is contained in:
zzz
2020-09-10 13:01:18 +00:00
parent 2fbbd8e7d1
commit 3b18e54545
2 changed files with 23 additions and 3 deletions

View File

@ -30,8 +30,20 @@ input.default { width: 1px; height: 1px; visibility: hidden; }
<h3 id="i2pclientconfig"><%=intl._t("Client Configuration")%></h3>
<p class="infohelp" id="clientconf">
<%=intl._t("The Java clients listed below are started by the router and run in the same JVM.")%>&nbsp;
<%=intl._t("To change other client options, edit the file")%>
<tt><%=net.i2p.router.startup.ClientAppConfig.configFile(net.i2p.I2PAppContext.getGlobalContext()).getAbsolutePath()%>.</tt>
<%
if (!clientshelper.isAdvanced()) {
net.i2p.I2PAppContext ctx = net.i2p.I2PAppContext.getGlobalContext();
if (net.i2p.router.startup.ClientAppConfig.isSplitConfig(ctx)) {
%>
<%=intl._t("To change client options, edit the files in the directory {0}.", "<tt>" + net.i2p.router.startup.ClientAppConfig.configDir(ctx).getAbsolutePath() + "</tt>")%>
<%
} else {
%>
<%=intl._t("To change client options, edit the file {0}.", "<tt>" + net.i2p.router.startup.ClientAppConfig.configFile(ctx).getAbsolutePath() + "</tt>")%>
<%
}
} // !isAdvanced()
%>
<%=intl._t("All changes require restart to take effect.")%>
</p>
<p class="infowarn" id="clientconf">

View File

@ -118,7 +118,7 @@ public class ClientAppConfig {
* Only valid after getClientApps(ctx) has been called.
* @since 0.9.42
*/
public synchronized static boolean isSplitConfig(RouterContext ctx) {
public synchronized static boolean isSplitConfig(I2PAppContext ctx) {
File dir = new File(ctx.getConfigDir(), CLIENT_CONFIG_DIR);
return dir.exists() && !configFile(ctx).exists();
}
@ -134,6 +134,14 @@ public class ClientAppConfig {
return cfgFile;
}
/*
* This is the config dir. Only valid if a split config.
* @since 0.9.48
*/
public static File configDir(I2PAppContext ctx) {
return new File(ctx.getConfigDir(), CLIENT_CONFIG_DIR);
}
/*
* Go through the files, and return a List of ClientAppConfig structures
* This is for the router.