mirror of
https://github.com/EduApps-CDG/OpenDX
synced 2024-12-30 09:45:37 +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::string getExeName() {
|
||||||
std::vector<WCHAR> exePath;
|
std::string fullPath = getExePath();
|
||||||
exePath.resize(MAX_PATH + 1);
|
|
||||||
|
|
||||||
DWORD len = ::GetModuleFileNameW(NULL, exePath.data(), MAX_PATH);
|
|
||||||
exePath.resize(len);
|
|
||||||
|
|
||||||
std::string fullPath = str::fromws(exePath.data());
|
|
||||||
auto n = fullPath.find_last_of('\\');
|
auto n = fullPath.find_last_of('\\');
|
||||||
|
|
||||||
return (n != std::string::npos)
|
return (n != std::string::npos)
|
||||||
? fullPath.substr(n + 1)
|
? fullPath.substr(n + 1)
|
||||||
: fullPath;
|
: 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) {
|
void setThreadName(const std::string& name) {
|
||||||
|
@ -25,6 +25,12 @@ namespace dxvk::env {
|
|||||||
*/
|
*/
|
||||||
std::string getExeName();
|
std::string getExeName();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Gets full path to executable
|
||||||
|
* \returns Path to executable
|
||||||
|
*/
|
||||||
|
std::string getExePath();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Sets name of the calling thread
|
* \brief Sets name of the calling thread
|
||||||
* \param [in] name Thread name
|
* \param [in] name Thread name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user