Correctly overwrite existing wav file

pull/213/head
James Ball 2024-01-28 19:33:10 +00:00 zatwierdzone przez James H Ball
rodzic cad5bad853
commit 95ab90ad63
1 zmienionych plików z 6 dodań i 2 usunięć

Wyświetl plik

@ -302,9 +302,13 @@ private:
| juce::FileBrowserComponent::canSelectFiles
| juce::FileBrowserComponent::warnAboutOverwriting,
[this](const juce::FileChooser& c) {
if (juce::FileInputStream inputStream(lastRecording); inputStream.openedOk())
if (const auto outputStream = makeOutputStream(c.getURLResult()))
if (juce::FileInputStream inputStream(lastRecording); inputStream.openedOk()) {
if (const auto outputStream = c.getURLResult().getLocalFile().createOutputStream()) {
outputStream->setPosition(0);
outputStream->truncate();
outputStream->writeFromInputStream(inputStream, -1);
}
}
lastRecording.deleteFile();
});