Added IsDirectory function to SystemFile (#4454)

* Added IsDirectory function to SystemFile

This takes the implementation in LocalFileIO and uses it for SystemFile
and then just has LocalFileIO call the SystemFile implementation

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Fixed logic to detect the WinApi FILE_ATTRIBUTE_DIRECTORY attribute

Updated the FileIO.cpp test to use AZ::IO::Path and removed direct uses
of AZStd::string

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Adding googletest printers for string and Path classes

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>

* Updated the SystemFile_WinAPI functions to use AZStd::to_wstring

This makes the the SystemFile function convert from UTF-8 to UTF-16

Signed-off-by: lumberyard-employee-dm <56135373+lumberyard-employee-dm@users.noreply.github.com>
This commit is contained in:
lumberyard-employee-dm
2021-10-04 16:36:54 -05:00
committed by GitHub
parent 7052ccfa52
commit 0a8170f52a
15 changed files with 350 additions and 354 deletions
@@ -40,26 +40,6 @@ namespace AZ
{
namespace IO
{
bool LocalFileIO::IsDirectory(const char* filePath)
{
ANDROID_IO_PROFILE_SECTION_ARGS("IsDir:%s", filePath);
char resolvedPath[AZ_MAX_PATH_LEN];
ResolvePath(filePath, resolvedPath, AZ_MAX_PATH_LEN);
if (AZ::Android::Utils::IsApkPath(resolvedPath))
{
return AZ::Android::APKFileHandler::IsDirectory(AZ::Android::Utils::StripApkPrefix(resolvedPath).c_str());
}
struct stat result;
if (stat(resolvedPath, &result) == 0)
{
return S_ISDIR(result.st_mode);
}
return false;
}
Result LocalFileIO::Copy(const char* sourceFilePath, const char* destinationFilePath)
{
char resolvedSourcePath[AZ_MAX_PATH_LEN];