-
Notifications
You must be signed in to change notification settings - Fork 146
JDK-8214069 : (JavaFX) Default to xdg-open for document opening on UNIX #293
JDK-8214069 : (JavaFX) Default to xdg-open for document opening on UNIX #293
Conversation
The above errors you are getting are compilation errors when trying to build the native code for the javafx.graphics module. Are you running gcc 8 by chance? If so, then you are hitting #226. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I presume you've tested this (manually, since we don't have an automated test for this feature) ?
*/ | ||
private void showDocumentUnix(final String uri) throws Exception { | ||
try { | ||
new ProcessBuilder("xdg-open", uri).start(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that I see what this is doing, wouldn't a simpler solution be to just take the original code and add "xdg-open"
to the browsers
list as the first item? You might still need a try/catch around the execution, so you could try the next item in the list if you got an exception.
In addition to being less code change, it would unify the approach between the case of using xdg-open and the specific browsers in the list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed that would be a cleaner way to go about it! Will change to it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed it. Just slightly reformatted the array declaration as I feel it looks much nicer this way. Let me know if that's fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look when I get a chance.
(also of course I tried it first) |
b34fecf
to
f35a4df
Compare
f35a4df
to
26fb4c0
Compare
Tracked in JBS as JDK-8214069. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good with one minor request to remove an unrelated addition of a blank line.
You can just push it as a separate commit with just that one line reverted (best not to squash it which will require a force push). I'll merge it and push to jfx-dev/rt tomorrow.
modules/javafx.graphics/src/main/java/com/sun/javafx/application/HostServicesDelegate.java
Outdated
Show resolved
Hide resolved
Looks good to me (apart from the unrelated newline) |
Or more accurately, I'll merge it shortly after you push the commit to remove the blank line. |
Removed the linefeed :-) |
As per #260, here is a PR to default to
xdg-open
for document opening on UNIX systems.It keeps the previous method as fallback in case of failure.
Little implementation note : chose to use try-catch rather than calling
which xdg-open
as this catches the nonexistence ofxdg-open
(never seen that for myself though) and also failure ofxdg-open
itself (in whatever case this might happen).The only backwards compatibility lost here is if the users/developers were (un)knowingly relying on the lookup order of the browsers and not expecting the default browser to be used (imagining they have multiple browsers installed). I reckon this is acceptable.
As a side-note, while there are no tests relating to that part of the code, I still got test failures relating to prism/gtk.
Would be an interesting topic to investigate given #287 maybe ? (although these warnings don't look like they would be related as they're mostly type casting issues)