Remove legacy 'CrySetFileAttributes' (#7226)

* Remove legacy function 'CrySetFileAttributes' and replace its only use with AZ::IO::SystemFile::* functions

Signed-off-by: Steve Pham <82231385+spham-amzn@users.noreply.github.com>
monroegm-disable-blank-issue-2
Steve Pham 4 years ago committed by GitHub
parent 112e310419
commit 0ba1cff08e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -856,18 +856,4 @@ DLL_EXPORT void OutputDebugString(const char* outputString)
#endif
// This code does not have a long life span and will be replaced soon
#if defined(APPLE) || defined(LINUX) || defined(DEFINE_LEGACY_CRY_FILE_OPERATIONS)
bool CrySetFileAttributes(const char* lpFileName, uint32 dwFileAttributes)
{
//TODO: implement
printf("CrySetFileAttributes not properly implemented yet\n");
return false;
}
#endif //defined(APPLE) || defined(LINUX)
#endif // AZ_TRAIT_LEGACY_CRYCOMMON_USE_WINDOWS_STUBS

@ -336,7 +336,6 @@ void SetFlags(T& dest, U flags, bool b)
#include AZ_RESTRICTED_FILE(platform_h)
#endif
bool CrySetFileAttributes(const char* lpFileName, uint32 dwFileAttributes);
threadID CryGetCurrentThreadId();
#ifdef __GNUC__

@ -24,7 +24,6 @@
#define PLATFORM_IMPL_H_SECTION_TRAITS 1
#define PLATFORM_IMPL_H_SECTION_CRYLOWLATENCYSLEEP 2
#define PLATFORM_IMPL_H_SECTION_CRYGETFILEATTRIBUTES 3
#define PLATFORM_IMPL_H_SECTION_CRYSETFILEATTRIBUTES 4
#define PLATFORM_IMPL_H_SECTION_CRY_FILE_ATTRIBUTE_STUBS 5
#define PLATFORM_IMPL_H_SECTION_CRY_SYSTEM_FUNCTIONS 6
#define PLATFORM_IMPL_H_SECTION_VIRTUAL_ALLOCATORS 7
@ -238,22 +237,6 @@ void InitRootDir(char szExeFileName[], uint nExeSize, char szExeRootName[], uint
}
}
//////////////////////////////////////////////////////////////////////////
bool CrySetFileAttributes(const char* lpFileName, uint32 dwFileAttributes)
{
#if defined(AZ_RESTRICTED_PLATFORM)
#define AZ_RESTRICTED_SECTION PLATFORM_IMPL_H_SECTION_CRYSETFILEATTRIBUTES
#include AZ_RESTRICTED_FILE(platform_impl_h)
#endif
#if defined(AZ_RESTRICTED_SECTION_IMPLEMENTED)
#undef AZ_RESTRICTED_SECTION_IMPLEMENTED
#else
AZStd::wstring lpFileNameW;
AZStd::to_wstring(lpFileNameW, lpFileName);
return SetFileAttributes(lpFileNameW.c_str(), dwFileAttributes) != 0;
#endif
}
//////////////////////////////////////////////////////////////////////////
threadID CryGetCurrentThreadId()
{

@ -1132,7 +1132,10 @@ bool CXmlNode::saveToFile(const char* fileName)
bool CXmlNode::saveToFile([[maybe_unused]] const char* fileName, size_t chunkSize, AZ::IO::HandleType fileHandle)
{
CrySetFileAttributes(fileName, FILE_ATTRIBUTE_NORMAL);
if (AZ::IO::SystemFile::Exists(fileName) && !AZ::IO::SystemFile::IsWritable(fileName))
{
AZ::IO::SystemFile::SetWritable(fileName, true);
}
if (chunkSize < 256 * 1024) // make at least 256k
{

Loading…
Cancel
Save