Skip to content

Commit 51853ea

Browse files
committed
Update finding program location
1 parent 5849d5f commit 51853ea

File tree

1 file changed

+3
-14
lines changed

1 file changed

+3
-14
lines changed

src/rpcore/mount_manager.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include <config_util.h>
77

88
#include <boost/filesystem.hpp>
9+
#include <boost/dll/runtime_symbol_info.hpp>
910

1011
#include "render_pipeline/rppanda/stdpy/file.hpp"
1112

@@ -148,20 +149,8 @@ void MountManager::Impl::mount(void)
148149

149150
std::string MountManager::Impl::find_basepath(void) const
150151
{
151-
// TODO: implement linux part.
152-
char path[MAX_PATH+1];
153-
const DWORD length = ::GetModuleFileNameA(NULL, path, sizeof(path)-1);
154-
155-
if (length != 0)
156-
{
157-
path[length] = L'\0';
158-
}
159-
else
160-
{
161-
throw std::system_error(std::error_code(GetLastError(), std::system_category()), "Fail to run GetModuleFileNameW.");
162-
}
163-
164-
Filename pth = Filename::from_os_specific(rppanda::join(path, ".."));
152+
Filename pth = Filename::from_os_specific(rppanda::join(
153+
Filename::from_os_specific(boost::dll::program_location().string()), ".."));
165154
pth.make_absolute();
166155

167156
return pth.get_fullpath();

0 commit comments

Comments
 (0)