diff --git a/apps/i2ptunnel/java/build.xml b/apps/i2ptunnel/java/build.xml index b4be255ccd0652535feb065fb0434c208e18f0a4..a009bc6979f04061c814c646d2815ae5f7ee42d7 100644 --- a/apps/i2ptunnel/java/build.xml +++ b/apps/i2ptunnel/java/build.xml @@ -235,6 +235,7 @@ <target name="warUpToDate"> <uptodate property="war.uptodate" targetfile="build/i2ptunnel.war" > <srcfiles dir= "../jsp" excludes="web.xml, web-fragment.xml, **/*.java, *.jsp" /> + <srcfiles dir= "build/obj" includes="**/ui/*.class **/web/*.class" /> </uptodate> <condition property="shouldListChanges2" > <and> diff --git a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/GeneralHelper.java b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/GeneralHelper.java index 50d57b7107943e8da7e7c62140b2c48bd80603a0..40e2d439f5f514b00f9e2f6b990e4c671929c7b0 100644 --- a/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/GeneralHelper.java +++ b/apps/i2ptunnel/java/src/net/i2p/i2ptunnel/ui/GeneralHelper.java @@ -267,13 +267,21 @@ public class GeneralHelper { public String getPrivateKeyFile(int tunnel) { return getPrivateKeyFile(_group, tunnel); } - public static String getPrivateKeyFile(TunnelControllerGroup tcg, int tunnel) { + + public String getPrivateKeyFile(TunnelControllerGroup tcg, int tunnel) { TunnelController tun = getController(tcg, tunnel); if (tun != null && tun.getPrivKeyFile() != null) return tun.getPrivKeyFile(); if (tunnel < 0) tunnel = tcg == null ? 999 : tcg.getControllers().size(); - return "i2ptunnel" + tunnel + "-privKeys.dat"; + String rv = "i2ptunnel" + tunnel + "-privKeys.dat"; + // Don't default to a file that already exists, + // which could happen after other tunnels are deleted. + int i = 0; + while ((new File(_context.getConfigDir(), rv)).exists()) { + rv = "i2ptunnel" + tunnel + '.' + (++i) + "-privKeys.dat"; + } + return rv; } public String getClientInterface(int tunnel) {