Replace substring check with full string check (#240)

* Replace substring check with full string check

* Searh for first directory
This commit is contained in:
jyvenugo 2019-10-16 15:30:41 -07:00 коммит произвёл GitHub
Родитель 3ffa01eeb9
Коммит 5c62fc47ea
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 10 добавлений и 10 удалений

Просмотреть файл

@ -50,19 +50,19 @@ std::wstring FilePathMappings::GetExecutablePath(std::wstring packageExecutableP
if (executionPathWSTR.find(L"VFS") != std::wstring::npos)
{
MsixCoreLib_GetPathChild(executionPathWSTR);
std::wstring executionPathDirectory = executionPathWSTR.substr(0, executionPathWSTR.find_first_of(L'\\'));
//Checks if the executable is in one of the known folders
for (auto pair : m_map)
auto it = m_map.find(executionPathDirectory);
if(it != m_map.end())
{
if (executionPathWSTR.find(pair.first) != std::wstring::npos)
{
//The executable exists in an unpacked directory
std::wstring executablePath = pair.second;
//The executable exists in an unpacked directory
std::wstring executablePath = it->second;
MsixCoreLib_GetPathChild(executionPathWSTR);
executablePath.push_back(L'\\');
executablePath.append(executionPathWSTR);
return executablePath;
}
MsixCoreLib_GetPathChild(executionPathWSTR);
executablePath.push_back(L'\\');
executablePath.append(executionPathWSTR);
return executablePath;
}
}