Fix test reference after subtitle fixes.
[dcpomatic.git] / src / lib / cross.cc
index d84c17c55b25318ef5b32a0a06eda8ee23ac1d16..29591c69f251cc9fd65de945e2e4e80ceab7f3be 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
 
     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
 
 */
 
-#include <fstream>
-#include <boost/algorithm/string.hpp>
 #include "cross.h"
 #include "compose.hpp"
 #include "log.h"
+#include "exceptions.h"
+#include <boost/algorithm/string.hpp>
 #ifdef DCPOMATIC_LINUX
 #include <unistd.h>
 #include <mntent.h>
@@ -42,7 +42,7 @@
 #include <netinet/in.h>
 #include <arpa/inet.h>
 #endif
-#include "exceptions.h"
+#include <fstream>
 
 #include "i18n.h"
 
@@ -151,6 +151,30 @@ app_contents ()
 }
 #endif
 
+boost::filesystem::path
+shared_path ()
+{
+#ifdef DCPOMATIC_LINUX
+#ifdef DCPOMATIC_DEBUG
+       char const * p = getenv ("DCPOMATIC_LINUX_SHARE_PREFIX");
+       if (p) {
+               return p;
+       }
+#endif
+       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> log)
 {