mirror of
https://github.com/apple/container.git
synced 2026-08-24 10:05:43 -05:00
[images]: fix image load/save to use FilePathOps utility (#1590)
- Relates to apple/containerization#744. - Use the new `FilePathOps` utility functions.
This commit is contained in:
@@ -18,6 +18,7 @@ import ArgumentParser
|
||||
import ContainerAPIClient
|
||||
import Containerization
|
||||
import ContainerizationError
|
||||
import ContainerizationOS
|
||||
import Foundation
|
||||
import SystemPackage
|
||||
import TerminalProgress
|
||||
@@ -33,11 +34,7 @@ extension Application {
|
||||
@Option(
|
||||
name: .shortAndLong, help: "Path to the image tar archive", completion: .file(),
|
||||
transform: { str in
|
||||
let path = FilePath(str)
|
||||
guard path.isRelative else { return path.lexicallyNormalized() }
|
||||
return FilePath(FileManager.default.currentDirectoryPath)
|
||||
.pushing(path)
|
||||
.lexicallyNormalized()
|
||||
FilePathOps.absolutePath(FilePath(str))
|
||||
})
|
||||
var input: FilePath?
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import ContainerResource
|
||||
import Containerization
|
||||
import ContainerizationError
|
||||
import ContainerizationOCI
|
||||
import ContainerizationOS
|
||||
import Foundation
|
||||
import SystemPackage
|
||||
import TerminalProgress
|
||||
@@ -48,11 +49,7 @@ extension Application {
|
||||
@Option(
|
||||
name: .shortAndLong, help: "Pathname for the saved image", completion: .file(),
|
||||
transform: { str in
|
||||
let path = FilePath(str)
|
||||
guard path.isRelative else { return path.lexicallyNormalized() }
|
||||
return FilePath(FileManager.default.currentDirectoryPath)
|
||||
.pushing(path)
|
||||
.lexicallyNormalized()
|
||||
FilePathOps.absolutePath(FilePath(str))
|
||||
})
|
||||
var output: FilePath?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user