Skip to content

Commit 0d95645

Browse files
committed
Add log check (Fixes issue #1)
1 parent 6dcc02d commit 0d95645

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/main/java/com/itzilly/shadowOverlay/Constants.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
public class Constants {
99

10-
public static String BUILD_NUMBER = "b20";
11-
public static String VERSION = "A0.3.0";
10+
public static String BUILD_NUMBER = "b21";
11+
public static String VERSION = "A0.3.1";
1212
public static String VERSION_SHORTHAND = VERSION + "-" + BUILD_NUMBER;
1313
public static String WINDOW_TITLE = "Shadow Overlay " + VERSION_SHORTHAND;
1414

src/main/java/com/itzilly/shadowOverlay/ShadowOverlay.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,33 @@
33
import com.itzilly.shadowOverlay.ui.MainWindow;
44
import org.ini4j.Ini;
55

6-
import java.io.File;
7-
import java.io.FileOutputStream;
8-
import java.io.IOException;
9-
import java.io.PrintStream;
6+
import java.io.*;
107

118
public class ShadowOverlay {
129
public static void main(String[] args) {
10+
boolean couldSetStream = false;
1311
try {
1412
System.setOut(new PrintStream(new FileOutputStream(Constants.APPDATA_PATH() + File.separator + "latest.out")));
1513
System.setErr(new PrintStream(new FileOutputStream(Constants.APPDATA_PATH() + File.separator + "latest.err")));
14+
couldSetStream = true;
1615
} catch (IOException e) {
17-
if (e.getMessage().endsWith("(The system cannot find the path specified)")) {
18-
boolean firstTime = true;
19-
}
2016
e.printStackTrace();
2117
}
2218

2319
boolean createdUserDirs = createdUserDirs();
2420

2521
genConfig();
2622

23+
if (!couldSetStream) {
24+
try {
25+
System.setOut(new PrintStream(new FileOutputStream(Constants.APPDATA_PATH() + File.separator + "latest.out")));
26+
System.setErr(new PrintStream(new FileOutputStream(Constants.APPDATA_PATH() + File.separator + "latest.err")));
27+
} catch (FileNotFoundException e) {
28+
System.exit(1);
29+
}
30+
31+
}
32+
2733
// Show main window
2834
MainWindow.showOverlay();
2935
}

0 commit comments

Comments
 (0)