From 60cde1e67faf6622ba8a7bf502561a20130bba38 Mon Sep 17 00:00:00 2001 From: Christophe Meynard Date: Thu, 18 Jul 2024 17:01:01 +0200 Subject: [PATCH] fix: rename fails on windows if destination file exists --- src/uni_stream.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/uni_stream.h b/src/uni_stream.h index 9f779b40..33f4f1c0 100644 --- a/src/uni_stream.h +++ b/src/uni_stream.h @@ -245,6 +245,7 @@ namespace uni_stream { inline int rename_file(const std::string& old_name, const std::string& new_name) { + ::remove(new_name.c_str()); return ::rename(old_name.c_str(),new_name.c_str()) < 0 ? errno : 0; }