From 3b15b6f9fb853c32c0553186b04f1609e04a7d97 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 2 Aug 2023 12:33:47 -0700 Subject: [PATCH] use SHGetKnownFolderPath SHGetFolderPathA is deprecated. Signed-off-by: Rosen Penev --- src/makernote_int.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/makernote_int.cpp b/src/makernote_int.cpp index 6619cb33..d8aae80f 100644 --- a/src/makernote_int.cpp +++ b/src/makernote_int.cpp @@ -30,11 +30,8 @@ namespace fs = std::experimental::filesystem; #include #include #else -#include -#ifndef CSIDL_PROFILE -#define CSIDL_PROFILE 40 -#endif #include +#include #endif #ifdef EXV_ENABLE_INIH @@ -74,9 +71,10 @@ std::string getExiv2ConfigPath() { } #ifdef _WIN32 - char buffer[1024]; - if (SUCCEEDED(SHGetFolderPathA(nullptr, CSIDL_PROFILE, nullptr, 0, buffer))) { + PWSTR buffer = nullptr; + if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Profile, 0, nullptr, &buffer))) { currentPath = buffer; + CoTaskMemFree(buffer); } #else auto pw = getpwuid(getuid());