Skip to content

Commit b532fc6

Browse files
committed
Extend UpdatableBoardsLibsFakeURLsHandler to handle real links
1 parent f975068 commit b532fc6

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Diff for: app/src/cc/arduino/UpdatableBoardsLibsFakeURLsHandler.java

+16
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
import javax.swing.event.HyperlinkEvent;
3535
import javax.swing.event.HyperlinkListener;
3636
import java.net.URL;
37+
import java.net.URI;
38+
import java.awt.Desktop;
39+
import java.io.IOException;
40+
import java.net.URISyntaxException;
3741

3842
public class UpdatableBoardsLibsFakeURLsHandler implements HyperlinkListener {
3943

@@ -71,6 +75,18 @@ public void openBoardLibManager(URL url) {
7175
return;
7276
}
7377

78+
if(Desktop.isDesktopSupported())
79+
{
80+
try {
81+
Desktop.getDesktop().browse(url.toURI());
82+
return;
83+
} catch (IOException e) {
84+
throw new IllegalArgumentException(url.getHost() + " is invalid");
85+
} catch (URISyntaxException e) {
86+
throw new IllegalArgumentException(url.getHost() + " is invalid");
87+
}
88+
}
89+
7490
throw new IllegalArgumentException(url.getHost() + " is invalid");
7591

7692
}

0 commit comments

Comments
 (0)