Skip to content

Commit 8c91692

Browse files
facchinmcmaglie
authored andcommitted
Boards Menu: add hint if core lives in sketchbook
1 parent ca20093 commit 8c91692

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

app/src/processing/app/Base.java

+4
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,10 @@ public void actionPerformed(ActionEvent actionevent) {
14941494
if (platformLabel == null)
14951495
platformLabel = targetPackage.getId() + "-" + targetPlatform.getId();
14961496

1497+
// add an hint that this core lives in sketchbook
1498+
if (targetPlatform.isInSketchbook())
1499+
platformLabel += " (in sketchbook)";
1500+
14971501
JMenu platformBoardsMenu = new JMenu(platformLabel);
14981502
MenuScroller.setScrollerFor(platformBoardsMenu);
14991503
platformMenus.add(platformBoardsMenu);

arduino-core/src/processing/app/debug/LegacyTargetPlatform.java

+5
Original file line numberDiff line numberDiff line change
@@ -245,4 +245,9 @@ public String toString() {
245245
res += " " + boardId + " = " + boards.get(boardId) + "\n";
246246
return res + "}";
247247
}
248+
249+
@Override
250+
public boolean isInSketchbook() {
251+
return getFolder().getAbsolutePath().startsWith(BaseNoGui.getDefaultSketchbookFolder().getAbsolutePath());
252+
}
248253
}

arduino-core/src/processing/app/debug/TargetPlatform.java

+6
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,10 @@ public interface TargetPlatform {
9494
*/
9595
public TargetPackage getContainerPackage();
9696

97+
/**
98+
* Returns true if the platform is installed in a subfolder of the sketchbook
99+
*
100+
* @return
101+
*/
102+
public boolean isInSketchbook();
97103
}

0 commit comments

Comments
 (0)