}
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
+#include <boost/dll/runtime_symbol_info.hpp>
#include <unistd.h>
#include <mntent.h>
#include <sys/types.h>
boost::filesystem::path
dist_writer_path ()
{
- return "dcpomatic2_dist_writer";
+ return boost::dll::program_location().parent_path() / "dcpomatic2_dist_writer";
}
/* Apparently there is no way to create an ofstream using a UTF-8
}
#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>
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;
+ return boost::dll::program_location().parent_path().parent_path();
}
boost::filesystem::path
}
#include <boost/algorithm/string.hpp>
#include <boost/foreach.hpp>
+#include <boost/dll/runtime_symbol_info.hpp>
#include <windows.h>
#include <winternl.h>
#include <winioctl.h>
static boost::filesystem::path
executable_path ()
{
- wchar_t dir[512];
- GetModuleFileName (GetModuleHandle(0), dir, sizeof(dir));
- PathRemoveFileSpec (dir);
- return dir;
+ return boost::dll::program_location().parent_path();
}
boost::filesystem::path