Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
Yet another change to the Windows API
Browse files Browse the repository at this point in the history
  • Loading branch information
pierr3 committed Feb 27, 2022
1 parent 3366767 commit a6dbf96
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
#endif

#ifdef SFML_SYSTEM_WINDOWS
#pragma comment(lib, "Shlwapi.lib")
#include <windows.h>
#include <Shlwapi.h>
#endif

#ifdef SFML_SYSTEM_LINUX
Expand Down Expand Up @@ -45,11 +43,11 @@ namespace afv_unix {
#endif

#ifdef SFML_SYSTEM_WINDOWS
wchar_t path[MAX_PATH] = { 0 };
GetModuleFileNameW(NULL, path, MAX_PATH);
PathRemoveFileSpecA(path);
std::wstring ws(path);
return std::string(ws.begin(), ws.end()) + std::string("/");
char buffer[MAX_PATH];
GetModuleFileNameA(NULL, buffer, MAX_PATH);
std::string::size_type pos = std::string(buffer).find_last_of("\\/");

return std::string(buffer).substr(0, pos);
#endif
#endif
}
Expand Down

0 comments on commit a6dbf96

Please sign in to comment.