X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcross_windows.cc;h=324b8cd8bd5cab03e3eb59266f7fbb2ea12f499a;hb=7bc591abc86ed4742f21f45ca1d6151cb14bc100;hp=a425186f1816d88cf4b3559ad64c1514245a8b12;hpb=e1cbceca253ebf16f49e5bc78e3f1d0157c37bee;p=dcpomatic.git diff --git a/src/lib/cross_windows.cc b/src/lib/cross_windows.cc index a425186f1..324b8cd8b 100644 --- a/src/lib/cross_windows.cc +++ b/src/lib/cross_windows.cc @@ -44,7 +44,9 @@ extern "C" { #include #undef DATADIR #include +#include #include +#include #include #include #include @@ -208,16 +210,9 @@ resources_path () boost::filesystem::path -xsd_path () +libdcp_resources_path () { - return directory_containing_executable().parent_path() / "xsd"; -} - - -boost::filesystem::path -tags_path () -{ - return directory_containing_executable().parent_path() / "tags"; + return resources_path (); } @@ -397,7 +392,17 @@ maybe_open_console () boost::filesystem::path home_directory () { - return boost::filesystem::path(getenv("userprofile")); + PWSTR wide_path; + auto result = SHGetKnownFolderPath(FOLDERID_Documents, 0, nullptr, &wide_path); + + if (result != S_OK) { + CoTaskMemFree(wide_path); + return boost::filesystem::path("c:\\"); + } + + auto path = wchar_to_utf8(wide_path); + CoTaskMemFree(wide_path); + return path; }