diff options
Diffstat (limited to 'src/lib/cross.cc')
| -rw-r--r-- | src/lib/cross.cc | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 47f07cf9d..30a953bb8 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -35,6 +35,7 @@ #include <sys/sysctl.h> #include <mach-o/dyld.h> #endif +#include "exceptions.h" using std::pair; using std::list; @@ -114,6 +115,24 @@ cpu_info () return info; } +#ifdef DCPOMATIC_OSX +/** @return Path of the Contents directory in the .app */ +boost::filesystem::path +app_contents () +{ + uint32_t size = 1024; + char buffer[size]; + if (_NSGetExecutablePath (buffer, &size)) { + throw StringError ("_NSGetExecutablePath failed"); + } + + boost::filesystem::path path (buffer); + path.remove_filename (); + path.remove_filename (); + return path; +} +#endif + void run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, shared_ptr<Log> log) { @@ -189,15 +208,8 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, share #endif #ifdef DCPOMATIC_OSX - uint32_t size = 1024; - char buffer[size]; - if (_NSGetExecutablePath (buffer, &size)) { - log->log ("_NSGetExecutablePath failed"); - return; - } - - boost::filesystem::path path (buffer); - path.remove_filename (); + boost::filesystem::path path = app_contents(); + path /= "MacOS"; path /= "ffprobe"; string ffprobe = path.string() + " \"" + content.string() + "\" 2> \"" + out.string() + "\""; |
