Skip to content

Commit 559cbaa

Browse files
committed
Update recording_tools.py
1 parent d460c1e commit 559cbaa

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

src/spikeinterface/core/recording_tools.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,13 @@ def write_binary_recording(
131131
data_size_bytes = dtype_size_bytes * num_frames * num_channels
132132
file_size_bytes = data_size_bytes + byte_offset
133133

134-
# create a file with file_size_bytes
134+
# Create an empty file with file_size_bytes
135135
file = open(file_path, "wb+")
136-
if platform.system() == "Windows":
137-
file.seek(file_size_bytes - 1)
138-
file.write(b"\0")
139-
else:
140-
file.truncate(file_size_bytes)
136+
137+
# The previous implementation `file.truncate(file_size_bytes)` was slow on Windows (#3408)
138+
file.seek(file_size_bytes - 1)
141139
file.write(b"\0")
140+
142141
file.close()
143142
assert Path(file_path).is_file()
144143

0 commit comments

Comments
 (0)