Fix incorrect type of Drive container
[dcpomatic.git] / src / lib / cross_osx.cc
index 52d3d647b1b568070955eadcc9a780de64424fcc..7197eef792d4cf9c4c3058414c0f8b9225801889 100644 (file)
@@ -31,6 +31,7 @@ extern "C" {
 }
 #include <boost/algorithm/string.hpp>
 #include <boost/foreach.hpp>
+#include <boost/dll/runtime_symbol_info.hpp>
 #include <sys/sysctl.h>
 #include <mach-o/dyld.h>
 #include <IOKit/pwr_mgt/IOPMLib.h>
@@ -89,17 +90,8 @@ cpu_info ()
 boost::filesystem::path
 app_contents ()
 {
-       uint32_t size = 1024;
-       char buffer[size];
-       if (_NSGetExecutablePath (buffer, &size)) {
-               throw runtime_error ("_NSGetExecutablePath failed");
-       }
-
-       boost::filesystem::path path (buffer);
-       path = boost::filesystem::canonical (path);
-       path = path.parent_path ();
-       path = path.parent_path ();
-       return path;
+       std::cout << "program_location=" << boost::dll::program_location() << "\n";
+       return boost::dll::program_location().parent_path().parent_path();
 }
 
 boost::filesystem::path
@@ -137,11 +129,11 @@ openssl_path ()
 }
 
 boost::filesystem::path
-dist_writer_path ()
+disk_writer_path ()
 {
        boost::filesystem::path path = app_contents();
        path /= "MacOS";
-       path /= "dcpomatic2_dist_writer";
+       path /= "dcpomatic2_disk_writer";
        return path;
 }
 
@@ -251,7 +243,7 @@ disk_appeared(DADiskRef disk, void* context)
 {
        const char* name = DADiskGetBSDName (disk);
        if (name) {
-               list<Drive>* drives = reinterpret_cast<list<Drive>*> (context);
+               vector<Drive>* drives = reinterpret_cast<vector<Drive>*> (context);
                drives->push_back (Drive(name, 0, false, optional<string>(), optional<string>()));
        }
 }