[VER] v0.3.8-alpha
[Impl][Fix] 更改resolveModulePath实现,使用绝对路径查找内置库
This commit is contained in:
22
src/Core/executablePath.hpp
Normal file
22
src/Core/executablePath.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <filesystem>
|
||||
#include <libloaderapi.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <libloaderapi.h>
|
||||
#endif
|
||||
|
||||
namespace Fig
|
||||
{
|
||||
inline std::filesystem::path getExecutablePath()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
wchar_t buffer[MAX_PATH];
|
||||
GetModuleFileNameW(nullptr, buffer, MAX_PATH);
|
||||
return std::filesystem::path(buffer);
|
||||
#else
|
||||
return std::filesystem::canonical("/proc/self/exe");
|
||||
#endif
|
||||
}
|
||||
}; // namespace Fig
|
||||
Reference in New Issue
Block a user