Remove TemporaryDirectory

This violates the responsibility of this framework.
This commit is contained in:
Max Howell
2019-01-19 14:20:12 -05:00
parent 9f76eeb507
commit cd30e89808

View File

@@ -1,8 +1,9 @@
@testable import Path
import Foundation import Foundation
public class TemporaryDirectory { class TemporaryDirectory {
public let url: URL let url: URL
public var path: Path { return Path(string: url.path) } var path: Path { return Path(string: url.path) }
/** /**
Creates a new temporary directory. Creates a new temporary directory.
@@ -19,7 +20,7 @@ public class TemporaryDirectory {
- Parameter appropriateFor: The temporary directory will be located on this - Parameter appropriateFor: The temporary directory will be located on this
volume. volume.
*/ */
public init(appropriateFor: URL? = nil) throws { init(appropriateFor: URL? = nil) throws {
#if !os(Linux) #if !os(Linux)
let appropriate: URL let appropriate: URL
if let appropriateFor = appropriateFor { if let appropriateFor = appropriateFor {
@@ -45,7 +46,7 @@ public class TemporaryDirectory {
} }
} }
public extension Path { extension Path {
static func mktemp<T>(body: (Path) throws -> T) throws -> T { static func mktemp<T>(body: (Path) throws -> T) throws -> T {
let tmp = try TemporaryDirectory() let tmp = try TemporaryDirectory()
return try body(tmp.path) return try body(tmp.path)