linux fixes

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-08-03 17:59:35 -07:00
parent cbfdf99a9e
commit e28602dbbb
42 changed files with 186 additions and 225 deletions
@@ -30,9 +30,8 @@ namespace AZ
result.m_pathIncludesFilename = true;
// Platform specific get exe path: http://stackoverflow.com/a/1024937
// https://docs.microsoft.com/en-us/windows/win32/api/libloaderapi/nf-libloaderapi-getmodulefilenamea
AZStd::wstring pathBuffer;
pathBuffer.resize(exeStorageSize);
const DWORD pathLen = GetModuleFileName(nullptr, pathBuffer.data(), static_cast<DWORD>(exeStorageSize));
wchar_t pathBufferW[AZ_MAX_PATH_LEN] = { 0 };
const DWORD pathLen = GetModuleFileNameW(nullptr, pathBufferW, static_cast<DWORD>(exeStorageSize));
const DWORD errorCode = GetLastError();
if (pathLen == exeStorageSize && errorCode == ERROR_INSUFFICIENT_BUFFER)
{
@@ -44,7 +43,7 @@ namespace AZ
}
else
{
AZStd::to_string(exeStorageBuffer, exeStorageSize, pathBuffer.c_str());
AZStd::to_string(exeStorageBuffer, exeStorageSize, pathBufferW);
}
return result;