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:
parent
0bb991a1fa
commit
18835c324e
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user