X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcross.cc;h=9894d885f1cea6e0c7a3a7e8f7d9d02a66d8b735;hb=419c025709132e21ce948c4a6051a323f06ee61d;hp=53ef5723ac50232d5e05fb8664a7b8dc3eba766d;hpb=f1d30fb114b3b2c6ccd8fdf5823e7cd6b26c1eef;p=dcpomatic.git diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 53ef5723a..9894d885f 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2014 Carl Hetherington + Copyright (C) 2012-2015 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -17,11 +17,11 @@ */ -#include -#include #include "cross.h" #include "compose.hpp" #include "log.h" +#include "exceptions.h" +#include #ifdef DCPOMATIC_LINUX #include #include @@ -42,7 +42,7 @@ #include #include #endif -#include "exceptions.h" +#include #include "i18n.h" @@ -151,6 +151,24 @@ app_contents () } #endif +boost::filesystem::path +shared_path () +{ +#ifdef DCPOMATIC_LINUX + return boost::filesystem::canonical (LINUX_SHARE_PREFIX); +#endif +#ifdef DCPOMATIC_WINDOWS + wchar_t dir[512]; + GetModuleFileName (GetModuleHandle (0), dir, sizeof (dir)); + PathRemoveFileSpec (dir); + boost::filesystem::path path = dir; + return path.parent_path(); +#endif +#ifdef DCPOMATIC_OSX + return app_contents(); +#endif +} + void run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, shared_ptr log) { @@ -202,7 +220,7 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, share CloseHandle (child_stderr_write); - while (1) { + while (true) { char buffer[512]; DWORD read; if (!ReadFile(child_stderr_read, buffer, sizeof(buffer), &read, 0) || read == 0) { @@ -247,7 +265,7 @@ mount_info () return m; } - while (1) { + while (true) { struct mntent* mnt = getmntent (f); if (!mnt) { break; @@ -310,7 +328,7 @@ void Waker::nudge () { #ifdef DCPOMATIC_WINDOWS - SetThreadExecutionState (ES_CONTINUOUS); + SetThreadExecutionState (ES_SYSTEM_REQUIRED); #endif }