Renaming a file on Unix and Unix-like systems (OSX/Linux) are guaranteed to be atomic when replacing one file with another. There is no way to do this in PureBasic without using DeleteFile() first as RenameFile() will return 0 (failure) if the target already exists.
Win32 provides a ReplaceFile() function as of Windows XP which does provide this feature as an atomic operation:
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
Citation for atomicity:
https://msdn.microsoft.com/en-us/librar ... s.85).aspx
It would be great if this were exposed in PureBasic with the addition of a flag of #PB_FileSystem_Replace to RenameFile() to guarantee this functionality across all supported platforms. As the atomic rename is not exposed at all on the operating systems which support it, this type of operation is currently guaranteed to be NOT atomic in PureBasic as a DeleteFile() must always be called first.