Changeset 10138 in josm
- Timestamp:
- 2016-04-11T11:58:14+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/ShowStatusReportAction.java
r10063 r10138 20 20 import java.util.Set; 21 21 import java.util.TreeSet; 22 import java.util.regex.Pattern; 22 23 23 24 import org.openstreetmap.josm.Main; … … 61 62 putValue("toolbar", "help/showstatusreport"); 62 63 Main.toolbar.register(this); 63 }64 65 private static void shortenParam(ListIterator<String> it, String[] param, String source, String target) {66 if (source != null && target.length() < source.length() && param[1].startsWith(source)) {67 it.set(param[0] + '=' + param[1].replace(source, target));68 }69 64 } 70 65 … … 120 115 final String propJavaHome = System.getProperty("java.home"); 121 116 final String propJavaHomeAlt = "<java.home>"; 117 final String prefDir = Main.pref.getPreferencesDirectory().toString(); 118 final String prefDirAlt = "<josm.pref>"; 119 final String userDataDir = Main.pref.getUserDataDirectory().toString(); 120 final String userDataDirAlt = "<josm.userdata>"; 121 final String userCacheDir = Main.pref.getCacheDirectory().toString(); 122 final String userCacheDirAlt = "<josm.cache>"; 123 final String userHomeDir = System.getProperty("user.home"); 124 final String userHomeDirAlt = Main.isPlatformWindows() ? "%UserProfile%" : "${HOME}"; 125 122 126 // Build a new list of VM parameters to modify it below if needed (default implementation returns an UnmodifiableList instance) 123 127 List<String> vmArguments = new ArrayList<>(ManagementFactory.getRuntimeMXBean().getInputArguments()); … … 130 134 it.set(param[0]+"=xxx"); 131 135 } else { 132 // Shorten some parameters for readability concerns 133 shortenParam(it, param, envJavaHome, envJavaHomeAlt); 134 shortenParam(it, param, propJavaHome, propJavaHomeAlt); 136 // Replace some paths for readability and privacy concerns 137 String val = param[1]; 138 val = paramReplace(val, envJavaHome, envJavaHomeAlt); 139 val = paramReplace(val, envJavaHome, envJavaHomeAlt); 140 val = paramReplace(val, propJavaHome, propJavaHomeAlt); 141 val = paramReplace(val, prefDir, prefDirAlt); 142 val = paramReplace(val, userDataDir, userDataDirAlt); 143 val = paramReplace(val, userCacheDir, userCacheDirAlt); 144 val = paramReplace(val, userHomeDir, userHomeDirAlt); 145 if (!val.equals(param[1])) { 146 it.set(param[0] + '=' + val); 147 } 135 148 } 136 149 } else if (value.startsWith("-X")) { … … 182 195 } 183 196 return set; 197 } 198 199 private static String paramReplace(String str, String target, String replacement) { 200 if (target == null) return str; 201 return str.replace(target, replacement); 184 202 } 185 203
Note:
See TracChangeset
for help on using the changeset viewer.