1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-01 07:24:12 +01:00

[util] Added getExeName() function

This will allow DXVK to apply game-specific
features or workarounds in the future.
This commit is contained in:
Philip Rebohle 2018-01-16 11:33:34 +01:00
parent 0bb991a1fa
commit 18835c324e
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 26 additions and 0 deletions

View File

@ -19,4 +19,20 @@ namespace dxvk::env {
return str::fromws(result);
}
std::string getExeName() {
std::wstring exePath;
exePath.resize(MAX_PATH + 1);
DWORD len = ::GetModuleFileNameW(NULL, &exePath.at(0), MAX_PATH);
exePath.resize(len);
std::string fullPath = str::fromws(exePath);
auto n = fullPath.find_last_of('\\');
return (n != std::string::npos)
? fullPath.substr(n + 1)
: fullPath;
}
}

View File

@ -15,4 +15,14 @@ namespace dxvk::env {
*/
std::string getEnvVar(const wchar_t* name);
/**
* \brief Gets the executable name
*
* Returns the base name (not the full path) of the
* program executable, including the file extension.
* This function should be used to identify programs.
* \returns Executable name
*/
std::string getExeName();
}