Skip to content

Commit e784970

Browse files
committed
Fix bundle parsing
1 parent 801f357 commit e784970

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Sources/hostmgr/commands/install/InstallHostmgrHelperCommand.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import libhostmgr
55
struct InstallHostmgrHelperCommand: AsyncParsableCommand {
66

77
static let configuration = CommandConfiguration(
8-
commandName: "hostmgr-helper",
8+
commandName: "helper",
99
abstract: "Install the `hostmgr-helper` tool"
1010
)
1111

Sources/libhostmgr/Model/LocalVMImage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ public struct LocalVMImage: Equatable, FilterableByBasename {
7373
public var basename: String {
7474
if architecture == .arm64 {
7575
return path
76-
.deletingPathExtension()
7776
.deletingPathExtension()
7877
.lastPathComponent
78+
.replacingOccurrences(of: ".vmpackage", with: "")
7979
} else {
8080
return path
8181
.deletingPathExtension()

Tests/libhostmgrTests/Model/LocalVMImageTests.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,18 @@ final class LocalVMImageTests: XCTestCase {
1818
func testThatPackagedAppleSiliconImageIsDetectedAsArm64() {
1919
XCTAssertEqual(LocalVMImage(path: URL(fileURLWithPath: "/test.vmtemplate"))?.architecture, .arm64)
2020
}
21+
22+
func testThatBundlesWithXcodeMinorVersionIsParsedCorrectly() {
23+
XCTAssertEqual(
24+
LocalVMImage(path: URL(fileURLWithPath: "/xcode-14.3.bundle"))?.basename,
25+
"xcode-14.3"
26+
)
27+
}
28+
29+
func testThatPackageWithXcodeMinorVersionIsParsedCorrectly() {
30+
XCTAssertEqual(
31+
LocalVMImage(path: URL(fileURLWithPath: "/xcode-14.3.vmpackage.aar"))?.basename,
32+
"xcode-14.3"
33+
)
34+
}
2135
}

0 commit comments

Comments
 (0)