Various fixes

This commit is contained in:
Ilya Laktyushin 2023-09-04 18:16:37 +04:00
parent 92eff4727a
commit f8ebd4aa2f

View File

@ -3087,6 +3087,8 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
return return
} }
try? FileManager.default.createDirectory(atPath: draftPath(engine: self.context.engine), withIntermediateDirectories: true)
let isScopedResource = url.startAccessingSecurityScopedResource() let isScopedResource = url.startAccessingSecurityScopedResource()
Logger.shared.log("MediaEditor", "isScopedResource = \(isScopedResource)") Logger.shared.log("MediaEditor", "isScopedResource = \(isScopedResource)")
@ -3096,8 +3098,6 @@ public final class MediaEditorScreen: ViewController, UIDropInteractionDelegate
let fileName = "audio_\(sourceUrl.lastPathComponent)" let fileName = "audio_\(sourceUrl.lastPathComponent)"
let copyPath = fullDraftPath(peerId: self.context.account.peerId, path: fileName) let copyPath = fullDraftPath(peerId: self.context.account.peerId, path: fileName)
Logger.shared.log("MediaEditor", "fileexists = \(FileManager.default.fileExists(atPath: sourceUrl.path))")
try? FileManager.default.removeItem(atPath: copyPath) try? FileManager.default.removeItem(atPath: copyPath)
do { do {
try FileManager.default.copyItem(at: sourceUrl, to: URL(fileURLWithPath: copyPath)) try FileManager.default.copyItem(at: sourceUrl, to: URL(fileURLWithPath: copyPath))