2025-01-13 00:33:13 +01:00
|
|
|
import Foundation
|
|
|
|
|
|
|
|
public struct CreateFoldersTask {
|
|
|
|
|
|
|
|
// MARK: Properties
|
|
|
|
|
|
|
|
private let fileService: FileServicing
|
|
|
|
|
|
|
|
// MARK: Initialisers
|
|
|
|
|
|
|
|
public init(fileService: FileServicing) {
|
|
|
|
self.fileService = fileService
|
|
|
|
}
|
|
|
|
|
|
|
|
// MARK: Functions
|
|
|
|
|
|
|
|
public func callAsFunction(at rootFolder: URL) async throws {
|
2025-01-18 11:38:01 +01:00
|
|
|
let folders = Folder.allCases.map { rootFolder.appendingPath($0.path) }
|
2025-01-16 01:45:41 +01:00
|
|
|
|
|
|
|
for folder in folders {
|
|
|
|
try await fileService.createFolder(at: folder)
|
|
|
|
}
|
2025-01-13 00:33:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|