Revert "Revert "add windows support (untested)""
This reverts commit 2158a700f4
.
This commit is contained in:
parent
2158a700f4
commit
541b9cc461
28 changed files with 379 additions and 351 deletions
|
@ -44,6 +44,7 @@ public enum Log {
|
|||
private static final List<LogMessage> LOG = Lists.newArrayList();
|
||||
|
||||
private static LogLevel level = LogLevel.INFO;
|
||||
private static boolean colors = true;
|
||||
private static IThreadListener sync = new IThreadListener() {
|
||||
public ListenableFuture<Object> schedule(Runnable run) {
|
||||
return null;
|
||||
|
@ -71,14 +72,16 @@ public enum Log {
|
|||
if(pos - last != 0)
|
||||
System.err.print(str.substring(last, pos));
|
||||
color = TextColor.getColor(c); // (c >= CHR_COLORS2) && (c <= CHR_COLORE2) ? aux_colors[c - CHR_COLORS2] : text_colors[c - CHR_COLORS1];
|
||||
System.err.printf("\u001b[38;2;%d;%d;%dm", (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
|
||||
if(colors)
|
||||
System.err.printf("\u001b[38;2;%d;%d;%dm", (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
|
||||
last = ++pos;
|
||||
continue;
|
||||
}
|
||||
else if(c == CHR_CRESET) {
|
||||
if(pos - last != 0)
|
||||
System.err.print(str.substring(last, pos));
|
||||
System.err.print("\u001b[0m");
|
||||
if(colors)
|
||||
System.err.print("\u001b[0m");
|
||||
last = ++pos;
|
||||
continue;
|
||||
}
|
||||
|
@ -99,7 +102,7 @@ public enum Log {
|
|||
if(pos >= str.length() && pos - last != 0)
|
||||
System.err.print(str.substring(last, pos));
|
||||
}
|
||||
System.err.print("\u001b[0m\n");
|
||||
System.err.print(colors ? "\u001b[0m\n" : "\n");
|
||||
}
|
||||
|
||||
public static String str_time(long time) {
|
||||
|
@ -112,6 +115,7 @@ public enum Log {
|
|||
|
||||
public static void init(IThreadListener sync) {
|
||||
Log.sync = sync;
|
||||
Log.colors = System.getProperty("log.nocolor") == null && !Util.WINDOWS;
|
||||
}
|
||||
|
||||
public static void flushLog() {
|
||||
|
|
|
@ -12,7 +12,8 @@ import common.collect.Maps;
|
|||
import common.log.Log;
|
||||
|
||||
public abstract class Util {
|
||||
private static long start = getTime();
|
||||
public static final boolean WINDOWS = System.getProperty("os.name").startsWith("Windows");
|
||||
private static final long START = getTime();
|
||||
|
||||
public static String strip(String str, int offset, int len, char newl, char tab, char unk) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
@ -303,10 +304,10 @@ int utf_len(const char *str) {
|
|||
}
|
||||
|
||||
public static void checkOs() {
|
||||
if(System.getProperty("os.name").startsWith("Windows") || System.getProperty("os.name").startsWith("Mac")) {
|
||||
if(System.getProperty("os.name").startsWith("Mac")) {
|
||||
String info = "Inkompatibles Betriebssystem";
|
||||
String msg = "Linux oder *BSD ist erforderlich, um dieses Programm auszuführen.\n" +
|
||||
"Alle Versionen von Windows und Mac OS (X) sind nicht kompatibel.";
|
||||
String msg = "Linux, *BSD oder Windows ist erforderlich, um dieses Programm\n" +
|
||||
"auszuführen. Alle Versionen von Mac OS (X) sind nicht kompatibel.";
|
||||
System.err.println("#################################################################");
|
||||
System.err.println("*** " + info + " ***");
|
||||
System.err.println(msg);
|
||||
|
@ -382,7 +383,7 @@ int utf_len(const char *str) {
|
|||
}
|
||||
|
||||
public static long rtime() {
|
||||
return Util.getTime() - start;
|
||||
return Util.getTime() - START;
|
||||
}
|
||||
|
||||
public static double ftime() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue