1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-01-18 20:52:10 +01:00

[util] Add method to retrieve full exe path

This commit is contained in:
Philip Rebohle 2019-08-17 11:46:40 +02:00
parent d38607c9be
commit c934333a5c
2 changed files with 18 additions and 7 deletions

View File

@ -13,19 +13,24 @@ namespace dxvk::env {
std::string getExeName() {
std::vector<WCHAR> exePath;
exePath.resize(MAX_PATH + 1);
DWORD len = ::GetModuleFileNameW(NULL, exePath.data(), MAX_PATH);
exePath.resize(len);
std::string fullPath = str::fromws(exePath.data());
std::string fullPath = getExePath();
auto n = fullPath.find_last_of('\\');
return (n != std::string::npos)
? fullPath.substr(n + 1)
: fullPath;
}
std::string getExePath() {
std::vector<WCHAR> exePath;
exePath.resize(MAX_PATH + 1);
DWORD len = ::GetModuleFileNameW(NULL, exePath.data(), MAX_PATH);
exePath.resize(len);
return str::fromws(exePath.data());
}
void setThreadName(const std::string& name) {

View File

@ -25,6 +25,12 @@ namespace dxvk::env {
*/
std::string getExeName();
/**
* \brief Gets full path to executable
* \returns Path to executable
*/
std::string getExePath();
/**
* \brief Sets name of the calling thread
* \param [in] name Thread name