*/
+#define UNICODE 1
+
#include "cross.h"
#include "compose.hpp"
#include "log.h"
fix_long_path (boost::filesystem::path long_path)
{
using namespace boost::filesystem;
- path fixed = "\\\\?\\";
+
+ if (boost::algorithm::starts_with(long_path.string(), "\\\\")) {
+ /* This could mean it starts with \\ (i.e. a SMB path) or \\?\ (a long path)
+ * or a variety of other things... anyway, we'll leave it alone.
+ */
+ return long_path;
+ }
+
/* We have to make the path canonical but we can't call canonical() on the long path
* as it will fail. So we'll sort of do it ourselves (possibly badly).
*/
+ path fixed = "\\\\?\\";
if (long_path.is_absolute()) {
fixed += long_path.make_preferred();
} else {
boost::filesystem::path
home_directory ()
{
- return boost::filesystem::path(getenv("HOMEDRIVE")) / boost::filesystem::path(getenv("HOMEPATH"));
+ return boost::filesystem::path(getenv("userprofile"));
}
boost::filesystem::path
-config_path ()
+config_path (optional<string> version)
{
boost::filesystem::path p;
p /= g_get_user_config_dir ();
p /= "dcpomatic2";
+ if (version) {
+ p /= *version;
+ }
return p;
}
return dcp::raw_convert<string>(GetCurrentProcessId());
}
+
+bool
+show_in_file_manager (boost::filesystem::path, boost::filesystem::path select)
+{
+ std::wstringstream args;
+ args << "/select," << select;
+ auto const r = ShellExecute (0, L"open", L"explorer.exe", args.str().c_str(), 0, SW_SHOWDEFAULT);
+ return (reinterpret_cast<int64_t>(r) <= 32);
+}
+