File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -159,10 +159,6 @@ Status Win::create_dir(const std::string& path) const {
159
159
}
160
160
161
161
Status Win::touch (const std::string& filename) const {
162
- if (is_file (filename)) {
163
- return Status::Ok ();
164
- }
165
-
166
162
HANDLE file_h = CreateFile (
167
163
filename.c_str (),
168
164
GENERIC_WRITE,
@@ -178,6 +174,10 @@ Status Win::touch(const std::string& filename) const {
178
174
tiledb::common::ScopedExecutor onexit1 (closefileonexit);
179
175
if (file_h == INVALID_HANDLE_VALUE) {
180
176
auto gle = GetLastError ();
177
+ if (gle == ERROR_FILE_EXISTS) {
178
+ // Do not fail if the file already exists.
179
+ return Status::Ok ();
180
+ }
181
181
return LOG_STATUS (Status_IOError (
182
182
std::string (" Failed to create file '" ) + filename + " (" +
183
183
get_last_error_msg (gle, " CreateFile" ) + " )'" ));
You can’t perform that action at this time.
0 commit comments