Skip to content

Commit

Permalink
fix: Exports fail when replacing existing files (#260)
Browse files Browse the repository at this point in the history
The macOS save panel allows users to select and replace existing files
but we still need to perform the deletion ourselves.
  • Loading branch information
jbmorley authored Oct 9, 2024
1 parent 455771e commit 74dba5c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Symbolic/Models/SceneModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ class SceneModel: ObservableObject, Runnable {

@MainActor func export(destination url: URL) {
do {
let fileManager = FileManager.default
if fileManager.fileExists(atPath: url.path) {
try fileManager.removeItem(at: url)
}
try document.export(destination: url)
NSWorkspace.shared.selectFile(nil, inFileViewerRootedAtPath: url.absoluteString)
} catch {
Expand Down

0 comments on commit 74dba5c

Please sign in to comment.