Skip to content

Commit 6ea164c

Browse files
committed
Support managing VMs by path
Related to hashicorp/vagrant#12760
1 parent 553b363 commit 6ea164c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Diff for: Sources/tart/VMStorageLocal.swift

+6-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,12 @@ class VMStorageLocal {
1212
}
1313

1414
func open(_ name: String) throws -> VMDirectory {
15-
let vmDir = VMDirectory(baseURL: vmURL(name))
15+
// support having a path as name for use cases like Vagrant Provider which manages locations of VMs on it's own
16+
var isDir:ObjCBool = true
17+
let nameIsPath = FileManager.default.fileExists(atPath: name, isDirectory: &isDir)
18+
let vmDir = VMDirectory(
19+
baseURL: nameIsPath ? URL(fileURLWithPath: name) : vmURL(name)
20+
)
1621

1722
try vmDir.validate()
1823

0 commit comments

Comments
 (0)