1 module common; 2 3 import std.stdio; 4 5 enum diggerVersion = "3.0 alpha 5"; 6 7 /// Send to stderr iff we have a console to write to 8 void writeToConsole(string s) 9 { 10 version (Windows) 11 { 12 import core.sys.windows.windows; 13 auto h = GetStdHandle(STD_ERROR_HANDLE); 14 if (!h || h == INVALID_HANDLE_VALUE) 15 return; 16 } 17 18 stderr.write(s); stderr.flush(); 19 } 20 21 void log(string s) 22 { 23 writeToConsole("digger: " ~ s ~ "\n"); 24 }