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:
parent
d38607c9be
commit
c934333a5c
@ -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) {
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user