2022-10-31 13:41:19 +01:00
|
|
|
//
|
|
|
|
// FileManager.swift
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Created by MainasuK on 2022-1-15.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
|
|
|
|
extension FileManager {
|
2023-09-21 12:52:05 +02:00
|
|
|
|
2022-10-31 13:41:19 +01:00
|
|
|
public func createTemporaryFileURL(
|
|
|
|
filename: String,
|
|
|
|
pathExtension: String
|
|
|
|
) throws -> URL {
|
|
|
|
let tempDirectoryURL = FileManager.default.temporaryDirectory
|
|
|
|
let fileURL = tempDirectoryURL
|
|
|
|
.appendingPathComponent(filename)
|
|
|
|
.appendingPathExtension(pathExtension)
|
|
|
|
try FileManager.default.createDirectory(at: tempDirectoryURL, withIntermediateDirectories: true, attributes: nil)
|
|
|
|
|
|
|
|
return fileURL
|
|
|
|
}
|
|
|
|
}
|