# HG changeset patch # User Jiri Vanek # Date 1545128170 -3600 # Node ID 19467a2f1f255aa736f5af2658de5b5cf38f4953 # Parent dfc800562a29ddfac9b16f3352738bcceb1f1faa PR3645, second part - following windows system paths correctly * netx/net/sourceforge/jnlp/config/PathsAndFiles.java: following https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/jcp/properties.html (SystemCofigFileDescriptor) now honor WINDIR on windows diff -r dfc800562a29 -r 19467a2f1f25 ChangeLog --- a/ChangeLog Tue Dec 18 11:15:38 2018 +0100 +++ b/ChangeLog Tue Dec 18 11:16:10 2018 +0100 @@ -1,3 +1,10 @@ +2018-11-27 Jiri Vanek + + PR3645, second part - following windows system paths correctly + * netx/net/sourceforge/jnlp/config/PathsAndFiles.java: following + https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/jcp/properties.html + (SystemCofigFileDescriptor) now honor WINDIR on windows + 2018-11-27 Jiri Vanek Lars Herschke diff -r dfc800562a29 -r 19467a2f1f25 netx/net/sourceforge/jnlp/config/PathsAndFiles.java --- a/netx/net/sourceforge/jnlp/config/PathsAndFiles.java Tue Dec 18 11:15:38 2018 +0100 +++ b/netx/net/sourceforge/jnlp/config/PathsAndFiles.java Tue Dec 18 11:16:10 2018 +0100 @@ -62,6 +62,7 @@ public static final String XDG_CACHE_HOME_VAR = "XDG_CACHE_HOME"; public static final String XDG_RUNTIME_DIR_VAR = "XDG_RUNTIME_DIR"; private static final String XDG_DATA_HOME = "XDG_DATA_HOME"; + private static final String WINDIR = "WINDIR"; private static final String TMP_PROP = "java.io.tmpdir"; private static final String HOME_PROP = "user.home"; private static final String JAVA_PROP = "java.home"; @@ -362,8 +363,25 @@ private static class SystemCofigFileDescriptor extends InfrastructureFileDescriptor { + private static final String windowsPathSuffix = File.separator + "Sun" + File.separator + "Java"; + private static final String unixPathSuffix = File.separator + "etc" + File.separator + ".java"; + + private static String getSystemConfigDir() { + if (JNLPRuntime.isWindows()) { + return System.getenv(WINDIR) + windowsPathSuffix; + } else { + return unixPathSuffix; + } + } + + @Override + public String getSystemPathStubAcronym() { + //note the hardcoded % instead of VARIABLE (actuall leading to idea, that docs, when generated on windows may not make sense) + return "{" + "%" + WINDIR + windowsPathSuffix + " or " + unixPathSuffix + "}"; + } + private SystemCofigFileDescriptor(String fileName, String pathSub, String description, Target... target) { - super(fileName, pathSub, File.separator + "etc" + File.separator + ".java", description, target); + super(fileName, pathSub, getSystemConfigDir(), description, target); } }