trackeditor: show error dialog when sd2-trackgen can't be found or executed
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8285 30fe4595-0a0c-4342-8851-515496e4dcbd Former-commit-id: 85efb1995763432b5c8fd606ac318d6a3f6d8c48 Former-commit-id: 294e33ba9e275833b98714bdb190b1b64e18d839
This commit is contained in:
parent
30f7a6c4df
commit
f6f056a238
1 changed files with 22 additions and 4 deletions
|
@ -24,10 +24,14 @@ import java.awt.Frame;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import javax.swing.JDialog;
|
import javax.swing.JDialog;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
import javax.swing.JPanel;
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JTextField;
|
import javax.swing.JTextField;
|
||||||
|
|
||||||
|
@ -41,9 +45,8 @@ import utils.Editor;
|
||||||
public class TrackgenPanel extends JDialog implements Runnable
|
public class TrackgenPanel extends JDialog implements Runnable
|
||||||
{
|
{
|
||||||
public static Vector args = new Vector();
|
public static Vector args = new Vector();
|
||||||
//private Properties properties = Properties.getInstance();
|
|
||||||
public EditorFrame parent;
|
public EditorFrame parent;
|
||||||
Thread ac3d = new Thread(this);
|
private Thread ac3d = new Thread(this);
|
||||||
|
|
||||||
private JPanel jPanel = null;
|
private JPanel jPanel = null;
|
||||||
private JLabel nameLabel = null;
|
private JLabel nameLabel = null;
|
||||||
|
@ -66,7 +69,6 @@ public class TrackgenPanel extends JDialog implements Runnable
|
||||||
ac3d.start();
|
ac3d.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method initializes this
|
* This method initializes this
|
||||||
*
|
*
|
||||||
|
@ -77,8 +79,8 @@ public class TrackgenPanel extends JDialog implements Runnable
|
||||||
this.setContentPane(getJPanel());
|
this.setContentPane(getJPanel());
|
||||||
this.setTitle("Trackgen");
|
this.setTitle("Trackgen");
|
||||||
this.setSize(475, 320);
|
this.setSize(475, 320);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
String category = " -c " + Editor.getProperties().getHeader().getCategory();
|
String category = " -c " + Editor.getProperties().getHeader().getCategory();
|
||||||
|
@ -89,8 +91,24 @@ public class TrackgenPanel extends JDialog implements Runnable
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
String trackgen = "sd2-trackgen";
|
||||||
String ls_str;
|
String ls_str;
|
||||||
String tmp = "";
|
String tmp = "";
|
||||||
|
|
||||||
|
Path path = Paths.get(trackgen);
|
||||||
|
|
||||||
|
if (!Files.isExecutable(path))
|
||||||
|
{
|
||||||
|
if (!Files.exists(path))
|
||||||
|
{
|
||||||
|
JOptionPane.showMessageDialog(this, "Can't find : " + trackgen +
|
||||||
|
"\n\nMake sure " + trackgen + " is installed or can be found using the path environment variable.",
|
||||||
|
"Export AC3D", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JOptionPane.showMessageDialog(this, "Can't execute : " + path.getFileName(), "Export AC3D", JOptionPane.ERROR_MESSAGE);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Process ls_proc = Runtime.getRuntime().exec("sd2-trackgen" + args);
|
Process ls_proc = Runtime.getRuntime().exec("sd2-trackgen" + args);
|
||||||
// get its output (your input) stream
|
// get its output (your input) stream
|
||||||
|
|
Loading…
Reference in a new issue