From 8525392f038797a7f6b618514c9ab09ce886bc39 Mon Sep 17 00:00:00 2001 From: Beingpax Date: Tue, 18 Nov 2025 14:32:21 +0545 Subject: [PATCH] Prevent deletion when re-selecting already stored custom sound --- VoiceInk/CustomSoundManager.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/VoiceInk/CustomSoundManager.swift b/VoiceInk/CustomSoundManager.swift index d04367e..5d67e0d 100644 --- a/VoiceInk/CustomSoundManager.swift +++ b/VoiceInk/CustomSoundManager.swift @@ -133,6 +133,10 @@ class CustomSoundManager: ObservableObject { let newFilename = "\(standardName).\(fileExtension)" let destinationURL = directory.appendingPathComponent(newFilename) + if sourceURL.resolvingSymlinksInPath() == destinationURL.resolvingSymlinksInPath() { + return .success(newFilename) + } + if FileManager.default.fileExists(atPath: destinationURL.path) { try? FileManager.default.removeItem(at: destinationURL) }