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
+3 -3
View File
@@ -46,7 +46,7 @@ namespace
SEfResTexture* pTex = pRes->GetTextureResource(nSlot);
if (pTex)
{
azstrcat(outName, Path::GamePathToFullPath(pTex->m_Name.c_str()).toUtf8().data());
azstrcat(outName, AZ_ARRAY_SIZE(outName), Path::GamePathToFullPath(pTex->m_Name.c_str()).toUtf8().data());
}
}
@@ -88,7 +88,7 @@ Export::CObject::CObject(const char* pName)
nParent = -1;
azstrcpy(name, pName);
azstrcpy(name, AZ_ARRAY_SIZE(name), pName);
materialName[0] = '\0';
@@ -102,7 +102,7 @@ Export::CObject::CObject(const char* pName)
void Export::CObject::SetMaterialName(const char* pName)
{
azstrcpy(materialName, pName);
azstrcpy(materialName, AZ_ARRAY_SIZE(materialName), pName);
}
@@ -92,7 +92,7 @@ void CCommentNodeAnimator::AnimateCommentTextTrack(CTrackViewTrack* pTrack, cons
if (commentKey.m_duration > 0 && ac.time < keyHandle.GetTime() + commentKey.m_duration)
{
m_commentContext.m_strComment = commentKey.m_strComment;
azstrcpy(m_commentContext.m_strFont, commentKey.m_strFont.c_str());
azstrcpy(m_commentContext.m_strFont, AZ_ARRAY_SIZE(m_commentContext.m_strFont), commentKey.m_strFont.c_str());
m_commentContext.m_color = commentKey.m_color;
m_commentContext.m_align = commentKey.m_align;
m_commentContext.m_size = commentKey.m_size;
@@ -2808,10 +2808,10 @@ void CTrackViewDopeSheetBase::DrawKeys(CTrackViewTrack* pTrack, QPainter* painte
}
else
{
azstrcpy(keydesc, "{");
azstrcpy(keydesc, AZ_ARRAY_SIZE(keydesc), "{");
}
azstrcat(keydesc, pDescription);
azstrcat(keydesc, "}");
azstrcat(keydesc, AZ_ARRAY_SIZE(keydesc), pDescription);
azstrcat(keydesc, AZ_ARRAY_SIZE(keydesc), "}");
// Draw key description text.
// Find next key.
const QRect textRect(QPoint(x + 10, rect.top()), QPoint(x1, rect.bottom()));
+1 -1
View File
@@ -2516,7 +2516,7 @@ int CTrackViewNodesCtrl::GetMatNameAndSubMtlIndexFromName(QString& matName, cons
if (const char* pCh = strstr(nodeName, ".["))
{
char matPath[MAX_PATH];
azstrncpy(matPath, nodeName, (size_t)(pCh - nodeName));
azstrncpy(matPath, AZ_ARRAY_SIZE(matPath), nodeName, (size_t)(pCh - nodeName));
matName = matPath;
pCh += 2;
if ((*pCh) != 0)
+4 -5
View File
@@ -2217,15 +2217,14 @@ uint32 CFileUtil::GetAttributes(const char* filename, bool bUseSourceControl /*=
return SCC_FILE_ATTRIBUTE_READONLY | SCC_FILE_ATTRIBUTE_INPAK;
}
AZStd::wstring fileW;
AZStd::to_wstring(fileW, file.GetAdjustedFilename());
DWORD dwAttrib = ::GetFileAttributesW(fileW.c_str());
if (dwAttrib == INVALID_FILE_ATTRIBUTES)
const char* adjustedFile = file.GetAdjustedFilename();
if (!AZ::IO::SystemFile::Exists(adjustedFile))
{
return SCC_FILE_ATTRIBUTE_INVALID;
}
if (dwAttrib & FILE_ATTRIBUTE_READONLY)
if (!AZ::IO::SystemFile::IsWritable(adjustedFile))
{
return SCC_FILE_ATTRIBUTE_NORMAL | SCC_FILE_ATTRIBUTE_READONLY;
}
+2 -11
View File
@@ -16,6 +16,7 @@
#include <AzFramework/StringFunc/StringFunc.h>
#include <AzFramework/API/ApplicationAPI.h>
#include <AzCore/std/string/conversions.h>
#include <AzFramework/IO/LocalFileIO.h>
#include <QRegularExpression>
@@ -203,16 +204,7 @@ namespace Path
bool IsFolder(const char* pPath)
{
AZStd::wstring pPathW;
AZStd::to_wstring(pPathW, pPath);
DWORD attrs = GetFileAttributes(pPathW.c_str());
if (attrs == FILE_ATTRIBUTE_DIRECTORY)
{
return true;
}
return false;
return AZ::IO::FileIOBase::GetInstance()->IsDirectory(pPath);
}
//////////////////////////////////////////////////////////////////////////
@@ -256,7 +248,6 @@ namespace Path
static AZStd::string s_currentModName;
// query the editor root. The bus exists in case we want tools to be able to override this.
if (s_currentModName.empty())
{
return GetGameAssetsFolder();
+2 -2
View File
@@ -106,7 +106,7 @@ namespace Path
path = path_buffer;
_makepath_s(path_buffer, AZ_ARRAY_SIZE(path_buffer), 0, 0, fname, ext);
#else
_splitpath(filepath, drive, dir, fname, ext);
_splitpath(filepath.c_str(), drive, dir, fname, ext);
_makepath(path_buffer, drive, dir, 0, 0);
path = path_buffer;
_makepath(path_buffer, 0, 0, fname, ext);
@@ -148,7 +148,7 @@ namespace Path
_splitpath_s(filepath.c_str(), drive, AZ_ARRAY_SIZE(drive), dir, AZ_ARRAY_SIZE(dir), fname, AZ_ARRAY_SIZE(fname), ext, AZ_ARRAY_SIZE(ext));
_makepath_s(path_buffer, AZ_ARRAY_SIZE(path_buffer), drive, dir, 0, 0);
#else
_splitpath(filepath, drive, dir, fname, ext);
_splitpath(filepath.c_str(), drive, dir, fname, ext);
_makepath(path_buffer, drive, dir, 0, 0);
#endif
path = path_buffer;
+1 -1
View File
@@ -15,7 +15,7 @@
int StringHelpers::CompareIgnoreCase(const AZStd::string& str0, const AZStd::string& str1)
{
const size_t minLength = Util::getMin(str0.length(), str1.length());
const int result = azmemicmp(str0.c_str(), str1.c_str(), minLength);
const int result = azstrnicmp(str0.c_str(), str1.c_str(), minLength);
if (result)
{
return result;
+3
View File
@@ -11,6 +11,9 @@
#define CRYINCLUDE_CRYCOMMONTOOLS_STRINGHELPERS_H
#pragma once
#include <AzCore/std/string/string.h>
#include <AzCore/std/containers/vector.h>
namespace StringHelpers
{
// compares two strings to see if they are the same or different, case is ignored