MSVC: Fix MoveFile error when destination exists

Use CopyFile with overwrite flag instead
This commit is contained in:
Le Philousophe 2019-09-25 18:23:34 +02:00
parent 66b8beede8
commit c893c5a60b

View File

@ -492,11 +492,10 @@ Sub CompareFileAndReplace(src_filename, dst_filename)
Set file = FSO.OpenTextFile(dst_filename, 1, 0, 0)
dst_data = file.ReadAll
file.Close
If StrComp(src_data, dst_data, vbBinaryCompare) = 0 Then
' Files are the same, just remove the source
FSO.DeleteFile src_filename
Else
If StrComp(src_data, dst_data, vbBinaryCompare) <> 0 Then
' Files are different, overwrite the destination
FSO.MoveFile src_filename, dst_filename
FSO.CopyFile src_filename, dst_filename, True
End If
' Remove temporary source
FSO.DeleteFile src_filename
End Sub