Skip to content

Commit

Permalink
use SHGetKnownFolderPath
Browse files Browse the repository at this point in the history
SHGetFolderPathA is deprecated.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
  • Loading branch information
neheb committed Aug 3, 2023
1 parent d16a304 commit c682ecc
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/makernote_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,8 @@ namespace fs = std::experimental::filesystem;
#include <pwd.h>
#include <unistd.h>
#else
#include <shlobj.h>
#ifndef CSIDL_PROFILE
#define CSIDL_PROFILE 40
#endif
#include <process.h>
#include <shlobj.h>
#endif

#ifdef EXV_ENABLE_INIH
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit c682ecc

Please sign in to comment.