use SHGetKnownFolderPath

SHGetFolderPathA is deprecated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
main
Rosen Penev 2 years ago
parent 898faffa0d
commit 3b15b6f9fb

@ -30,11 +30,8 @@ namespace fs = std::experimental::filesystem;
#include <pwd.h> #include <pwd.h>
#include <unistd.h> #include <unistd.h>
#else #else
#include <shlobj.h>
#ifndef CSIDL_PROFILE
#define CSIDL_PROFILE 40
#endif
#include <process.h> #include <process.h>
#include <shlobj.h>
#endif #endif
#ifdef EXV_ENABLE_INIH #ifdef EXV_ENABLE_INIH
@ -74,9 +71,10 @@ std::string getExiv2ConfigPath() {
} }
#ifdef _WIN32 #ifdef _WIN32
char buffer[1024]; PWSTR buffer = nullptr;
if (SUCCEEDED(SHGetFolderPathA(nullptr, CSIDL_PROFILE, nullptr, 0, buffer))) { if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_Profile, 0, nullptr, &buffer))) {
currentPath = buffer; currentPath = buffer;
CoTaskMemFree(buffer);
} }
#else #else
auto pw = getpwuid(getuid()); auto pw = getpwuid(getuid());

Loading…
Cancel
Save