mirror of
https://github.com/ninxsoft/Mist.git
synced 2025-05-21 10:45:27 -04:00
Create intermediate cache directories
This commit is contained in:
parent
531068629d
commit
7ae18dfbf6
2 changed files with 5 additions and 4 deletions
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue