#include "cross.h"
#include "compose.hpp"
#include "log.h"
+#include "config.h"
#include "exceptions.h"
extern "C" {
#include <libavformat/avio.h>
#include <windows.h>
#undef DATADIR
#include <shlwapi.h>
+#include <shellapi.h>
+#include <fcntl.h>
#endif
#ifdef DCPOMATIC_OSX
#include <sys/sysctl.h>
#if defined(DCPOMATIC_LINUX) || defined(DCPOMATIC_OSX)
pid_t pid = fork ();
if (pid == 0) {
- std::cout << "start " << batch << " from " << dcpomatic << "\n";
int const r = system (batch.string().c_str());
exit (WEXITSTATUS (r));
}
return avio_open (s, file.c_str(), flags);
#endif
}
+
+#ifdef DCPOMATIC_WINDOWS
+void
+maybe_open_console ()
+{
+ if (Config::instance()->win32_console ()) {
+ AllocConsole();
+
+ HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
+ int hCrt = _open_osfhandle((intptr_t) handle_out, _O_TEXT);
+ FILE* hf_out = _fdopen(hCrt, "w");
+ setvbuf(hf_out, NULL, _IONBF, 1);
+ *stdout = *hf_out;
+
+ HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE);
+ hCrt = _open_osfhandle((intptr_t) handle_in, _O_TEXT);
+ FILE* hf_in = _fdopen(hCrt, "r");
+ setvbuf(hf_in, NULL, _IONBF, 128);
+ *stdin = *hf_in;
+ }
+}
+#endif