culturered_client/TokenCore/Src/Util.cpp
2024-09-07 11:34:44 +08:00

35 lines
611 B
C++

#include "Util.h"
#include <time.h>
#include <fstream>
#ifdef _WIN32
#include <windows.h>
#include <Shlobj.h>
#elif __linux__
#include <unistd.h>
#elif __APPLE__
#include <sys/sysctl.h>
#endif
#ifdef _WIN32
std::string GetDllPathPlatform() {
HMODULE hModule = GetModuleHandle(TEXT("TokenCore.dll"));
char szPath[MAX_PATH] = { 0 };
GetModuleFileNameA(hModule, szPath, MAX_PATH);
std::string::size_type pos = std::string(szPath).find_last_of("\\/");
return std::string(szPath).substr(0, pos) + "/";
}
#elif __linux__
#elif __APPLE__
#endif
std::string GetDllPath() {
return GetDllPathPlatform();
}