Skip to content

Commit 001fac1

Browse files
committed
Fix compilation errors
1 parent 7790d60 commit 001fac1

File tree

6 files changed

+11
-12
lines changed

6 files changed

+11
-12
lines changed

Sources/XcodesKit/Entry+.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import Foundation
22
import Path
33

4-
extension Entry {
4+
extension Path {
55
var isAppBundle: Bool {
6-
kind == .directory &&
7-
path.extension == "app" &&
8-
!path.isSymlink
6+
type == .directory &&
7+
`extension` == "app" &&
8+
!isSymlink
99
}
1010

1111
var infoPlist: InfoPlist? {
12-
let infoPlistPath = path.join("Contents").join("Info.plist")
12+
let infoPlistPath = join("Contents").join("Info.plist")
1313
guard
1414
let infoPlistData = try? Data(contentsOf: infoPlistPath.url),
1515
let infoPlist = try? PropertyListDecoder().decode(InfoPlist.self, from: infoPlistData)

Sources/XcodesKit/Environment.swift

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,8 @@ public struct Files {
277277
public var contentsOfDirectory: (URL) throws -> [URL] = { try FileManager.default.contentsOfDirectory(at: $0, includingPropertiesForKeys: nil, options: []) }
278278

279279
public var installedXcodes: (Path) -> [InstalledXcode] = { directory in
280-
return ((try? directory.ls()) ?? [])
280+
return directory.ls()
281281
.filter { $0.isAppBundle && $0.infoPlist?.bundleID == "com.apple.dt.Xcode" }
282-
.map { $0.path }
283282
.compactMap(InstalledXcode.init)
284283
}
285284
}

Sources/XcodesKit/Path+.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import Foundation
33

44
extension Path {
55
// Get Home even if we are running as root
6-
static let environmentHome = ProcessInfo.processInfo.environment["HOME"].flatMap(Path.init) ?? .home
6+
static let environmentHome = ProcessInfo.processInfo.environment["HOME"].flatMap(Path.init) ?? Path(Path.home)
77
static let environmentApplicationSupport = environmentHome/"Library/Application Support"
88
static let environmentCaches = environmentHome/"Library/Caches"
99
public static let environmentDownloads = environmentHome/"Downloads"

Sources/XcodesKit/Process.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public typealias ProcessOutput = (status: Int32, out: String, err: String)
77

88
extension Process {
99
@discardableResult
10-
static func sudo(password: String? = nil, _ executable: Path, workingDirectory: URL? = nil, _ arguments: String...) -> Promise<ProcessOutput> {
10+
static func sudo(password: String? = nil, _ executable: some Pathish, workingDirectory: URL? = nil, _ arguments: String...) -> Promise<ProcessOutput> {
1111
var arguments = [executable.string] + arguments
1212
if password != nil {
1313
arguments.insert("-S", at: 0)
@@ -16,7 +16,7 @@ extension Process {
1616
}
1717

1818
@discardableResult
19-
static func run(_ executable: Path, workingDirectory: URL? = nil, input: String? = nil, _ arguments: String...) -> Promise<ProcessOutput> {
19+
static func run(_ executable: some Pathish, workingDirectory: URL? = nil, input: String? = nil, _ arguments: String...) -> Promise<ProcessOutput> {
2020
return run(executable.url, workingDirectory: workingDirectory, input: input, arguments)
2121
}
2222

Sources/XcodesKit/RuntimeInstaller.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ public class RuntimeInstaller {
137137
// 1-Mount DMG and get the mounted path
138138
let mountedUrl = try await mountDMG(dmgUrl: dmgUrl)
139139
// 2-Get the first path under the mounted path, should be a .pkg
140-
let pkgPath = try! Path(url: mountedUrl)!.ls().first!.path
140+
let pkgPath = Path(url: mountedUrl)!.ls().first!
141141
// 3-Create a caches directory (if it doesn't exist), and
142142
// 4-Set its ownership to the current user (important because under sudo it would be owned by root)
143143
try Path.xcodesCaches.mkdir().setCurrentUserAsOwner()

Sources/XcodesKit/Version+Xcode.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public extension Version {
5959
}
6060

6161
/// Attempt to instatiate a `Version` using the `.xcode-version` file in the provided directory
62-
static func fromXcodeVersionFile(inDirectory: Path = Path.cwd) -> Version? {
62+
static func fromXcodeVersionFile(inDirectory: some Pathish = Path.cwd) -> Version? {
6363
let xcodeVersionFilePath = inDirectory.join(".xcode-version")
6464
guard
6565
Current.files.fileExists(atPath: xcodeVersionFilePath.string),

0 commit comments

Comments
 (0)