From: Carl Hetherington Date: Thu, 26 Mar 2020 19:42:09 +0000 (+0100) Subject: Specify full path to dcpomatic2_dist_writer and tidy a few things up. X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=0c67033958fa0e01646e99f8d61a9c877d9c0f6a;p=dcpomatic.git Specify full path to dcpomatic2_dist_writer and tidy a few things up. --- diff --git a/src/lib/cross.h b/src/lib/cross.h index 06b5417bf..63e542dc9 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -45,6 +45,7 @@ extern std::string cpu_info (); extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path); extern std::list > mount_info (); extern boost::filesystem::path openssl_path (); +extern boost::filesystem::path dist_writer_path (); #ifdef DCPOMATIC_OSX extern boost::filesystem::path app_contents (); #endif diff --git a/src/lib/cross_linux.cc b/src/lib/cross_linux.cc index a609e19f0..5073abe08 100644 --- a/src/lib/cross_linux.cc +++ b/src/lib/cross_linux.cc @@ -139,6 +139,12 @@ openssl_path () return "dcpomatic2_openssl"; } +boost::filesystem::path +dist_writer_path () +{ + return "dcpomatic2_dist_writer"; +} + /* Apparently there is no way to create an ofstream using a UTF-8 filename under Windows. We are hence reduced to using fopen with this wrapper. diff --git a/src/lib/cross_osx.cc b/src/lib/cross_osx.cc index 2f6066285..52d3d647b 100644 --- a/src/lib/cross_osx.cc +++ b/src/lib/cross_osx.cc @@ -136,6 +136,15 @@ openssl_path () return path; } +boost::filesystem::path +dist_writer_path () +{ + boost::filesystem::path path = app_contents(); + path /= "MacOS"; + path /= "dcpomatic2_dist_writer"; + return path; +} + /* Apparently there is no way to create an ofstream using a UTF-8 filename under Windows. We are hence reduced to using fopen with this wrapper. diff --git a/src/lib/cross_windows.cc b/src/lib/cross_windows.cc index b97e2bbd0..8d3ddbb8f 100644 --- a/src/lib/cross_windows.cc +++ b/src/lib/cross_windows.cc @@ -105,16 +105,6 @@ cpu_info () return info; } -boost::filesystem::path -shared_path () -{ - wchar_t dir[512]; - GetModuleFileName (GetModuleHandle (0), dir, sizeof (dir)); - PathRemoveFileSpec (dir); - boost::filesystem::path path = dir; - return path.parent_path(); -} - void run_ffprobe (boost::filesystem::path content, boost::filesystem::path out) { @@ -189,17 +179,31 @@ mount_info () return m; } -boost::filesystem::path -openssl_path () +static boost::filesystem::path +executable_path () { wchar_t dir[512]; - GetModuleFileName (GetModuleHandle (0), dir, sizeof (dir)); + GetModuleFileName (GetModuleHandle(0), dir, sizeof(dir)); PathRemoveFileSpec (dir); + return dir; +} - boost::filesystem::path path = dir; - path /= "openssl.exe"; - return path; +boost::filesystem::path +shared_path () +{ + return executable_path().parent_path(); +} +boost::filesystem::path +openssl_path () +{ + return executable_path() / "openssl.exe"; +} + +boost::filesystem::path +dist_writer_path () +{ + return executable_path() / "dcpomatic2_dist_writer.exe"; } /* Apparently there is no way to create an ofstream using a UTF-8 diff --git a/src/tools/dcpomatic_dist.cc b/src/tools/dcpomatic_dist.cc index a9d8f9bda..5f1778b6b 100644 --- a/src/tools/dcpomatic_dist.cc +++ b/src/tools/dcpomatic_dist.cc @@ -113,7 +113,7 @@ public: Bind (wxEVT_SIZE, boost::bind (&DOMFrame::sized, this, _1)); - _writer = new boost::process::child ("dcpomatic2_dist_writer"); + _writer = new boost::process::child (dist_writer_path()); } private: