mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Cleanup.
This commit is contained in:
@@ -1152,6 +1152,21 @@ void keyBindingHelp(const char* _bindings, const char* _description)
|
||||
ImGui::Text("%s", _description);
|
||||
}
|
||||
|
||||
inline std::string replaceAll(const char* _str, const char* _from, const char* _to)
|
||||
{
|
||||
std::string str = _str;
|
||||
size_t startPos = 0;
|
||||
const size_t fromLen = bx::strLen(_from);
|
||||
const size_t toLen = bx::strLen(_to);
|
||||
while ( (startPos = str.find(_from, startPos) ) != std::string::npos)
|
||||
{
|
||||
str.replace(startPos, fromLen, _to);
|
||||
startPos += toLen;
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void associate()
|
||||
{
|
||||
#if BX_PLATFORM_WINDOWS
|
||||
@@ -1160,7 +1175,7 @@ void associate()
|
||||
char exec[bx::kMaxFilePath];
|
||||
GetModuleFileNameA(GetModuleHandleA(NULL), exec, sizeof(exec) );
|
||||
|
||||
std::string strExec = bx::replaceAll<std::string>(exec, "\\", "\\\\");
|
||||
std::string strExec = replaceAll(exec, "\\", "\\\\");
|
||||
|
||||
std::string value;
|
||||
bx::stringPrintf(value, "@=\"\\\"%s\\\" \\\"%%1\\\"\"\r\n\r\n", strExec.c_str() );
|
||||
|
||||
Reference in New Issue
Block a user