X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcross_osx.cc;h=574cc8660887b059185dc5d120fa18fb6d114af7;hb=d1957e43ef4a3966e35b9f28b8faf96e925d2310;hp=66be376d4cc7264d26d76a8a62a7bb406f207668;hpb=13f302149a2a2846d801689e3d194af3249ed0b7;p=dcpomatic.git diff --git a/src/lib/cross_osx.cc b/src/lib/cross_osx.cc index 66be376d4..574cc8660 100644 --- a/src/lib/cross_osx.cc +++ b/src/lib/cross_osx.cc @@ -32,6 +32,9 @@ extern "C" { #include #include #include +#if BOOST_VERSION >= 106100 +#include +#endif #include #include #include @@ -91,14 +94,13 @@ cpu_info () return info; } -/** @return Path of the Contents directory in the .app */ + boost::filesystem::path -app_contents () +directory_containing_executable () { - /* Could use boost::dll::program_location().parent_path().parent_path() but that - * boost library isn't in the 10.6 environment we're currently using and I don't - * really want to change it right now. - */ +#if BOOST_VERSION >= 106100 + return boost::dll::program_location().parent_path(); +#else uint32_t size = 1024; char buffer[size]; if (_NSGetExecutablePath (buffer, &size)) { @@ -107,29 +109,29 @@ app_contents () boost::filesystem::path path (buffer); path = boost::filesystem::canonical (path); - path = path.parent_path (); - path = path.parent_path (); - return path; + return path.parent_path (); +#endif } + boost::filesystem::path shared_path () { - return app_contents() / "Resources"; + return directory_containing_executable().parent_path() / "Resources"; } + void run_ffprobe (boost::filesystem::path content, boost::filesystem::path out) { - boost::filesystem::path path = app_contents(); - path /= "MacOS"; - path /= "ffprobe"; + boost::filesystem::path path = directory_containing_executable () / "ffprobe"; string ffprobe = "\"" + path.string() + "\" \"" + content.string() + "\" 2> \"" + out.string() + "\""; LOG_GENERAL (N_("Probing with %1"), ffprobe); system (ffprobe.c_str ()); } + list > mount_info () { @@ -140,21 +142,16 @@ mount_info () boost::filesystem::path openssl_path () { - boost::filesystem::path path = app_contents(); - path /= "MacOS"; - path /= "openssl"; - return path; + return directory_containing_executable() / "openssl"; } + #ifdef DCPOMATIC_DISK /* Note: this isn't actually used at the moment as the disk writer is started as a service */ boost::filesystem::path disk_writer_path () { - boost::filesystem::path path = app_contents(); - path /= "MacOS"; - path /= "dcpomatic2_disk_writer"; - return path; + return directory_containing_executable() / "dcpomatic2_disk_writer"; } #endif @@ -196,9 +193,9 @@ Waker::~Waker () } void -start_tool (boost::filesystem::path dcpomatic, string executable, string app) +start_tool (string executable, string app) { - boost::filesystem::path batch = dcpomatic.parent_path (); + boost::filesystem::path batch = directory_containing_executable(); batch = batch.parent_path (); // MacOS batch = batch.parent_path (); // Contents batch = batch.parent_path (); // DCP-o-matic.app @@ -215,18 +212,21 @@ start_tool (boost::filesystem::path dcpomatic, string executable, string app) } } + void -start_batch_converter (boost::filesystem::path dcpomatic) +start_batch_converter () { - start_tool (dcpomatic, "dcpomatic2_batch", "DCP-o-matic\\ 2\\ Batch\\ Converter.app"); + start_tool ("dcpomatic2_batch", "DCP-o-matic\\ 2\\ Batch\\ Converter.app"); } + void -start_player (boost::filesystem::path dcpomatic) +start_player () { - start_tool (dcpomatic, "dcpomatic2_player", "DCP-o-matic\\ 2\\ Player.app"); + start_tool ("dcpomatic2_player", "DCP-o-matic\\ 2\\ Player.app"); } + uint64_t thread_id () { @@ -298,10 +298,19 @@ analyse_media_path (CFDictionaryRef& description) void const* str = CFDictionaryGetValue (description, kDADiskDescriptionMediaPathKey); if (!str) { + LOG_DISK_NC("There is no MediaPathKey"); return optional(); } string path(CFStringGetCStringPtr((CFStringRef) str, kCFStringEncodingUTF8)); + LOG_DISK("MediaPathKey is %1", path); + + if (path.find("/IOHDIXController") != string::npos) { + /* This is a disk image, so we completely ignore it */ + LOG_DISK_NC("Ignoring this as it seems to be a disk image"); + return optional(); + } + MediaPath mp; if (starts_with(path, "IODeviceTree:")) { mp.real = true; @@ -494,15 +503,6 @@ Drive::get () } -string -Drive::device_for_write () const -{ - string w = _device; - boost::replace_all (w, "/dev/disk", "/dev/rdisk"); - return w; -} - - boost::filesystem::path config_path () {