mirror of
https://github.com/GTAIV-Complete-Edition-text/GTA4.CHS
synced 2026-11-26 09:27:55 +08:00
40 lines
692 B
C++
40 lines
692 B
C++
#include "module_path.h"
|
|
|
|
ModulePath::ModulePath(HMODULE module)
|
|
{
|
|
m_Module = module;
|
|
SetModule(module);
|
|
}
|
|
|
|
void ModulePath::SetModule(HMODULE module)
|
|
{
|
|
m_ModuleDir.clear();
|
|
|
|
m_Module = module;
|
|
|
|
wchar_t w_path[512];
|
|
::GetModuleFileNameW(module, w_path, 512);
|
|
path_type module_path = w_path;
|
|
m_ModuleDir = module_path.parent_path();
|
|
}
|
|
|
|
HMODULE ModulePath::GetModule() const
|
|
{
|
|
return m_Module;
|
|
}
|
|
|
|
ModulePath::path_type ModulePath::GetModuleDir() const
|
|
{
|
|
return m_ModuleDir;
|
|
}
|
|
|
|
ModulePath::path_type ModulePath::GetRelativeSub(const path_type& rest) const
|
|
{
|
|
if (m_ModuleDir.empty())
|
|
{
|
|
return {};
|
|
}
|
|
|
|
return m_ModuleDir / rest;
|
|
}
|