Skip to content

Commit a46e503

Browse files
Allow overriding platform.txt using platform.local.txt
This helps advanced users that want to change options (e.g. to use a different toolchain or enable warnings), without having to change platform.txt (which could make git report changed files all the time).
1 parent b2500b3 commit a46e503

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

app/src/processing/app/debug/TargetPlatform.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,20 @@ public TargetPlatform(String _name, File _folder, TargetPackage parent)
110110
format(_("Error loading {0}"), platformsFile.getAbsolutePath()), e);
111111
}
112112

113+
// Allow overriding values in platform.txt. This allows changing
114+
// platform.txt (e.g. to use a system-wide toolchain), without
115+
// having to modify platform.txt (which, when running from git,
116+
// prevents files being marked as changed).
117+
File localPlatformsFile = new File(folder, "platform.local.txt");
118+
try {
119+
if (localPlatformsFile.exists() && localPlatformsFile.canRead()) {
120+
preferences.load(localPlatformsFile);
121+
}
122+
} catch (IOException e) {
123+
throw new TargetPlatformException(
124+
format(_("Error loading {0}"), localPlatformsFile.getAbsolutePath()), e);
125+
}
126+
113127
File progFile = new File(folder, "programmers.txt");
114128
try {
115129
if (progFile.exists() && progFile.canRead()) {

0 commit comments

Comments
 (0)