Prevent deletion when re-selecting already stored custom sound
This commit is contained in:
parent
ff0be0092b
commit
8525392f03
@ -133,6 +133,10 @@ class CustomSoundManager: ObservableObject {
|
|||||||
let newFilename = "\(standardName).\(fileExtension)"
|
let newFilename = "\(standardName).\(fileExtension)"
|
||||||
let destinationURL = directory.appendingPathComponent(newFilename)
|
let destinationURL = directory.appendingPathComponent(newFilename)
|
||||||
|
|
||||||
|
if sourceURL.resolvingSymlinksInPath() == destinationURL.resolvingSymlinksInPath() {
|
||||||
|
return .success(newFilename)
|
||||||
|
}
|
||||||
|
|
||||||
if FileManager.default.fileExists(atPath: destinationURL.path) {
|
if FileManager.default.fileExists(atPath: destinationURL.path) {
|
||||||
try? FileManager.default.removeItem(at: destinationURL)
|
try? FileManager.default.removeItem(at: destinationURL)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user