No-op; fix GPL address and use the explicit-program-name version.
[dcpomatic.git] / src / lib / cross.cc
index 24abf2c0a99a64a74df01f814394f7417148a7cc..7996070982c84ec32b536d1decea82a20460bfb2 100644 (file)
@@ -1,19 +1,20 @@
 /*
     Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
 
-    This program is free software; you can redistribute it and/or modify
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    This program is distributed in the hope that it will be useful,
+    DCP-o-matic is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 
@@ -353,3 +354,45 @@ Waker::~Waker ()
        IOPMAssertionRelease (_assertion_id);
 #endif
 }
+
+void
+start_batch_converter (boost::filesystem::path dcpomatic)
+{
+#if defined(DCPOMATIC_LINUX) || defined(DCPOMATIC_WINDOWS)
+       boost::filesystem::path batch = dcpomatic.parent_path() / "dcpomatic2_batch";
+#endif
+
+#ifdef DCPOMATIC_OSX
+       boost::filesystem::path batch = dcpomatic.parent_path ();
+       batch = batch.parent_path (); // MacOS
+       batch = batch.parent_path (); // Contents
+       batch = batch.parent_path (); // DCP-o-matic.app
+       batch = batch.parent_path (); // Applications
+       batch /= "DCP-o-matic\\ 2\\ Batch\\ Converter.app";
+       batch /= "Contents";
+       batch /= "MacOS";
+       batch /= "dcpomatic2_batch";
+#endif
+
+#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));
+       }
+#endif
+
+#ifdef DCPOMATIC_WINDOWS
+       STARTUPINFO startup_info;
+       ZeroMemory (&startup_info, sizeof (startup_info));
+       startup_info.cb = sizeof (startup_info);
+
+       PROCESS_INFORMATION process_info;
+       ZeroMemory (&process_info, sizeof (process_info));
+
+       wchar_t cmd[512];
+       MultiByteToWideChar (CP_UTF8, 0, batch.string().c_str(), -1, cmd, sizeof(cmd));
+       CreateProcess (0, cmd, 0, 0, FALSE, 0, 0, 0, &startup_info, &process_info);
+#endif
+}