mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-16 05:53:06 -04:00
Restrict non Desktop API for linux only (Win7 cause problems)
This commit is contained in:
parent
5b5bacc397
commit
15854bdf06
@ -21,6 +21,8 @@ import com.google.gson.FieldNamingPolicy;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@ -78,6 +80,24 @@ public class Utilities {
|
||||
}
|
||||
}
|
||||
|
||||
public static void openURI(URI uri) throws IOException {
|
||||
if (!isLinux()
|
||||
&& Desktop.isDesktopSupported()
|
||||
&& Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
|
||||
Desktop.getDesktop().browse(uri);
|
||||
}
|
||||
else {
|
||||
// On Linux Desktop is poorly implemented.
|
||||
// See https://stackoverflow.com/questions/18004150/desktop-api-is-not-supported-on-the-current-platform
|
||||
if (!DesktopApi.browse(uri))
|
||||
throw new IOException("Failed to open URI: " + uri.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static void openWebPage(String target) throws Exception {
|
||||
openURI(new URI(target));
|
||||
}
|
||||
|
||||
|
||||
public static <T> T jsonToObject(String jsonString, Class<T> classOfT) {
|
||||
Gson gson =
|
||||
@ -138,16 +158,6 @@ public class Utilities {
|
||||
printElapsedTime("");
|
||||
}
|
||||
|
||||
public static void openURI(URI uri) throws Exception {
|
||||
// On Linux Desktop is poorly implemented.
|
||||
// See https://stackoverflow.com/questions/18004150/desktop-api-is-not-supported-on-the-current-platform
|
||||
if (!DesktopApi.browse(uri))
|
||||
throw new Exception("Failed to open URI: " + uri.toString());
|
||||
}
|
||||
|
||||
public static void openWebPage(String target) throws Exception {
|
||||
openURI(new URI(target));
|
||||
}
|
||||
|
||||
public static Object copy(Serializable orig) {
|
||||
Object obj = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user