2025-01-11 01:26:26 +01:00
|
|
|
import Foundation
|
|
|
|
|
2025-01-11 03:24:22 +01:00
|
|
|
public protocol FileServicing {
|
2025-01-11 01:26:26 +01:00
|
|
|
|
2025-01-11 03:24:22 +01:00
|
|
|
// MARK: Computed
|
2025-01-11 01:26:26 +01:00
|
|
|
|
|
|
|
var currentFolder: URL { get async }
|
|
|
|
|
2025-01-11 03:24:22 +01:00
|
|
|
// MARK: Functions
|
|
|
|
|
2025-01-14 23:52:33 +01:00
|
|
|
func copyItem(from source: URL, to destination: URL) async throws (FileServiceError)
|
2025-01-13 23:27:50 +01:00
|
|
|
func createFolder(at location: URL) async throws (FileServiceError)
|
|
|
|
func deleteItem(at location: URL) async throws (FileServiceError)
|
|
|
|
func isItemExists(at location: URL) async throws (FileServiceError) -> Bool
|
2025-01-11 03:24:22 +01:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: - Errors
|
|
|
|
|
|
|
|
public enum FileServiceError: Error, Equatable {
|
|
|
|
case folderNotCreated
|
2025-01-14 23:52:33 +01:00
|
|
|
case itemNotCopied
|
2025-01-13 23:27:50 +01:00
|
|
|
case itemAlreadyExists
|
|
|
|
case itemNotDeleted
|
|
|
|
case itemNotExists
|
|
|
|
case itemNotFileURL
|
2025-01-11 01:26:26 +01:00
|
|
|
}
|