From cd30e89808dd8190ea7896a0cf3139c1c865c6ef Mon Sep 17 00:00:00 2001 From: Max Howell Date: Sat, 19 Jan 2019 14:20:12 -0500 Subject: [PATCH] Remove TemporaryDirectory This violates the responsibility of this framework. --- {Sources => Tests/PathTests}/TemporaryDirectory.swift | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) rename {Sources => Tests/PathTests}/TemporaryDirectory.swift (90%) diff --git a/Sources/TemporaryDirectory.swift b/Tests/PathTests/TemporaryDirectory.swift similarity index 90% rename from Sources/TemporaryDirectory.swift rename to Tests/PathTests/TemporaryDirectory.swift index 5fae422..1e1577f 100644 --- a/Sources/TemporaryDirectory.swift +++ b/Tests/PathTests/TemporaryDirectory.swift @@ -1,8 +1,9 @@ +@testable import Path import Foundation -public class TemporaryDirectory { - public let url: URL - public var path: Path { return Path(string: url.path) } +class TemporaryDirectory { + let url: URL + var path: Path { return Path(string: url.path) } /** Creates a new temporary directory. @@ -19,7 +20,7 @@ public class TemporaryDirectory { - Parameter appropriateFor: The temporary directory will be located on this volume. */ - public init(appropriateFor: URL? = nil) throws { + init(appropriateFor: URL? = nil) throws { #if !os(Linux) let appropriate: URL if let appropriateFor = appropriateFor { @@ -45,7 +46,7 @@ public class TemporaryDirectory { } } -public extension Path { +extension Path { static func mktemp(body: (Path) throws -> T) throws -> T { let tmp = try TemporaryDirectory() return try body(tmp.path)