File tree 1 file changed +22
-0
lines changed
app/src/processing/app/helpers
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 29
29
import java .io .IOException ;
30
30
import java .io .InputStream ;
31
31
import java .util .HashMap ;
32
+ import java .util .HashSet ;
32
33
import java .util .Hashtable ;
33
34
import java .util .Map ;
35
+ import java .util .Set ;
34
36
37
+ import processing .app .Base ;
35
38
import processing .core .PApplet ;
36
39
37
40
public class PreferencesMap extends HashMap <String , String > {
@@ -78,6 +81,25 @@ public void load(InputStream input) throws IOException {
78
81
put (key .trim (), value .trim ());
79
82
}
80
83
}
84
+
85
+ // This is needed to avoid ConcurrentAccessExceptions
86
+ Set <String > keys = new HashSet <String >(keySet ());
87
+
88
+ // Override keys that have OS specific versions
89
+ for (String k : keys ) {
90
+ boolean replace = false ;
91
+ if (Base .isLinux () && k .endsWith (".linux" ))
92
+ replace = true ;
93
+ if (Base .isWindows () && k .endsWith (".windows" ))
94
+ replace = true ;
95
+ if (Base .isMacOS () && k .endsWith (".macos" ))
96
+ replace = true ;
97
+ if (replace ) {
98
+ int dot = k .lastIndexOf ('.' );
99
+ String overridenKey = k .substring (0 , dot );
100
+ put (overridenKey , get (k ));
101
+ }
102
+ }
81
103
}
82
104
83
105
/**
You can’t perform that action at this time.
0 commit comments