File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
app/src/processing/app/helpers Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 2929import java .io .IOException ;
3030import java .io .InputStream ;
3131import java .util .HashMap ;
32+ import java .util .HashSet ;
3233import java .util .Hashtable ;
3334import java .util .Map ;
35+ import java .util .Set ;
3436
37+ import processing .app .Base ;
3538import processing .core .PApplet ;
3639
3740public class PreferencesMap extends HashMap <String , String > {
@@ -78,6 +81,25 @@ public void load(InputStream input) throws IOException {
7881 put (key .trim (), value .trim ());
7982 }
8083 }
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+ }
81103 }
82104
83105 /**
You can’t perform that action at this time.
0 commit comments