author | wenzelm |
Mon, 13 Apr 2020 22:08:14 +0200 | |
changeset 71751 | abf3e80bd815 |
parent 69838 | 4419d4d675c3 |
child 71932 | 65fd0f032a75 |
permissions | -rw-r--r-- |
69188
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
1 |
diff -ru 5.5.0/jEdit/org/gjt/sp/jedit/MiscUtilities.java 5.5.0/jEdit-patched/org/gjt/sp/jedit/MiscUtilities.java |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
2 |
--- 5.5.0/jEdit/org/gjt/sp/jedit/MiscUtilities.java 2018-04-09 01:57:06.000000000 +0200 |
69838
4419d4d675c3
formal update of patches -- no change of content;
wenzelm
parents:
69191
diff
changeset
|
3 |
+++ 5.5.0/jEdit-patched/org/gjt/sp/jedit/MiscUtilities.java 2019-02-24 12:21:09.602678130 +0100 |
69191 | 4 |
@@ -126,6 +126,21 @@ |
69188
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
5 |
static final Pattern winPattern = Pattern.compile(winPatternString); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
6 |
|
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
7 |
|
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
8 |
+ private static Map<String,String> environ = |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
9 |
+ Collections.synchronizedMap(new HashMap(System.getenv())); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
10 |
+ |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
11 |
+ public static String getenv(String varName) |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
12 |
+ { |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
13 |
+ return environ.get(varName); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
14 |
+ } |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
15 |
+ |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
16 |
+ public static void putenv(String varName, String value) |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
17 |
+ { |
69191 | 18 |
+ if (value == null) environ.remove(varName); |
19 |
+ else environ.put(varName, value); |
|
69188
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
20 |
+ } |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
21 |
+ |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
22 |
+ |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
23 |
/** A helper function for expandVariables when handling Windows paths on non-windows systems. |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
24 |
*/ |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
25 |
private static String win2unix(String winPath) |
69191 | 26 |
@@ -135,7 +150,7 @@ |
69188
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
27 |
if (m.find()) |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
28 |
{ |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
29 |
String varName = m.group(2); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
30 |
- String expansion = System.getenv(varName); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
31 |
+ String expansion = getenv(varName); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
32 |
if (expansion != null) |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
33 |
return m.replaceFirst(expansion); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
34 |
} |
69191 | 35 |
@@ -174,7 +189,7 @@ |
69188
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
36 |
return arg; |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
37 |
} |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
38 |
String varName = m.group(2); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
39 |
- String expansion = System.getenv(varName); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
40 |
+ String expansion = getenv(varName); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
41 |
if (expansion == null) { |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
42 |
if (varName.equalsIgnoreCase("jedit_settings") && jEdit.getSettingsDirectory() != null) { |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
43 |
expansion = jEdit.getSettingsDirectory(); |
69191 | 44 |
@@ -184,7 +199,7 @@ |
69188
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
45 |
varName = varName.toUpperCase(); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
46 |
String uparg = arg.toUpperCase(); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
47 |
m = p.matcher(uparg); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
48 |
- expansion = System.getenv(varName); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
49 |
+ expansion = getenv(varName); |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
50 |
} |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
51 |
} |
2fd73a1a0937
updated to jedit_build-20181025 according to patches/macos (Java 11), patches/putenv;
wenzelm
parents:
diff
changeset
|
52 |
if (expansion != null) { |
69191 | 53 |
@@ -1637,13 +1652,11 @@ |
54 |
//{{{ VarCompressor constructor |
|
55 |
VarCompressor() |
|
56 |
{ |
|
57 |
- ProcessBuilder pb = new ProcessBuilder(); |
|
58 |
- Map<String, String> env = pb.environment(); |
|
59 |
if (OperatingSystem.isUnix()) |
|
60 |
prefixMap.put(System.getProperty("user.home"), "~"); |
|
61 |
if (jEdit.getSettingsDirectory() != null) |
|
62 |
prefixMap.put(jEdit.getSettingsDirectory(), "JEDIT_SETTINGS"); |
|
63 |
- for (Map.Entry<String, String> entry: env.entrySet()) |
|
64 |
+ for (Map.Entry<String, String> entry: environ.entrySet()) |
|
65 |
{ |
|
66 |
String k = entry.getKey(); |
|
67 |
if (k.equalsIgnoreCase("pwd") || k.equalsIgnoreCase("oldpwd")) continue; |