diff --git a/Mist/Helpers/DirectoryCreator.swift b/Mist/Helpers/DirectoryCreator.swift index 9d6804f..8edd671 100644 --- a/Mist/Helpers/DirectoryCreator.swift +++ b/Mist/Helpers/DirectoryCreator.swift @@ -13,11 +13,12 @@ struct DirectoryCreator { /// Create a directory at the provided URL. /// /// - Parameters: - /// - url: The URL of the directory to create. + /// - url: The URL of the directory to create. + /// - withIntermediateDirectories: Set to `true` to create all intermediate directories. /// /// - Throws: An `Error` if the command failed to execute. - static func create(_ url: URL) async throws { + static func create(_ url: URL, withIntermediateDirectories: Bool = false) async throws { try await DirectoryRemover.remove(url) - try FileManager.default.createDirectory(at: url, withIntermediateDirectories: false, attributes: nil) + try FileManager.default.createDirectory(at: url, withIntermediateDirectories: withIntermediateDirectories, attributes: nil) } } diff --git a/Mist/Helpers/TaskManager.swift b/Mist/Helpers/TaskManager.swift index beebcbb..38a1f92 100644 --- a/Mist/Helpers/TaskManager.swift +++ b/Mist/Helpers/TaskManager.swift @@ -216,7 +216,7 @@ class TaskManager: ObservableObject { if !FileManager.default.fileExists(atPath: cacheDirectoryURL.path) { tasks += [ MistTask(type: .configure, description: "cache directory") { - try await DirectoryCreator.create(cacheDirectoryURL) + try await DirectoryCreator.create(cacheDirectoryURL, withIntermediateDirectories: true) } ] }