diff --git a/Code/Legacy/CryCommon/WinBase.cpp b/Code/Legacy/CryCommon/WinBase.cpp index 771cde324e..6e6f5e210a 100644 --- a/Code/Legacy/CryCommon/WinBase.cpp +++ b/Code/Legacy/CryCommon/WinBase.cpp @@ -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 diff --git a/Code/Legacy/CryCommon/platform.h b/Code/Legacy/CryCommon/platform.h index d2251c7091..512f8b4892 100644 --- a/Code/Legacy/CryCommon/platform.h +++ b/Code/Legacy/CryCommon/platform.h @@ -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__ diff --git a/Code/Legacy/CryCommon/platform_impl.cpp b/Code/Legacy/CryCommon/platform_impl.cpp index 8cbc58ad95..3392c40771 100644 --- a/Code/Legacy/CryCommon/platform_impl.cpp +++ b/Code/Legacy/CryCommon/platform_impl.cpp @@ -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() { diff --git a/Code/Legacy/CrySystem/XML/xml.cpp b/Code/Legacy/CrySystem/XML/xml.cpp index fb0714500c..2356e71518 100644 --- a/Code/Legacy/CrySystem/XML/xml.cpp +++ b/Code/Legacy/CrySystem/XML/xml.cpp @@ -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 {