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
+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