Skip to content

Commit

Permalink
Changed method to open URL and folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Safranil committed Jun 28, 2016
1 parent d92df3d commit 51dcb95
Showing 1 changed file with 4 additions and 22 deletions.
26 changes: 4 additions & 22 deletions src/main/java/fr/safranil/minecraft/miroa/OptionController.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
package fr.safranil.minecraft.miroa;

import javafx.application.HostServices;
import javafx.collections.FXCollections;
import javafx.fxml.FXML;
import javafx.scene.control.*;
Expand Down Expand Up @@ -76,40 +77,21 @@ public void initialize() {
}

javaField.setText(launcher.getJavaBin());

if (!Desktop.isDesktopSupported()) {
MiroaLauncher.LOGGER.info("Disabling hyperlinks, desktop is not supported");
hyperlinkLauncher.setDisable(true);
hyperlinkLog.setDisable(true);
hyperlinkWebsite.setDisable(true);
}
}

@FXML
public void openWebsite () {
try {
Desktop.getDesktop().browse(URI.create("http://minecraft.safranil.fr/"));
} catch (IOException e) {
e.printStackTrace();
}
Main.hostServices.showDocument("http://minecraft.safranil.fr/");
}

@FXML
public void openLog () {
try {
Desktop.getDesktop().open(new File(MiroaLauncher.OS.getWorkingDirectory(), "logs"));
} catch (IOException e) {
e.printStackTrace();
}
Main.hostServices.showDocument((new File(MiroaLauncher.OS.getWorkingDirectory(), "logs")).getAbsolutePath());
}

@FXML
public void openLauncherDir () {
try {
Desktop.getDesktop().open(MiroaLauncher.OS.getWorkingDirectory());
} catch (IOException e) {
e.printStackTrace();
}
Main.hostServices.showDocument(MiroaLauncher.OS.getWorkingDirectory().getAbsolutePath());
}

@FXML
Expand Down

0 comments on commit 51dcb95

Please sign in to comment.