From 1f4b47061ed1b034fca154c5aee3dfb7ff3d69f6 Mon Sep 17 00:00:00 2001 From: Saehej Kang <20051028+saehejkang@users.noreply.github.com> Date: Fri, 5 Jun 2026 09:28:08 -0700 Subject: [PATCH] [images]: fix image load/save to use FilePathOps utility (#1590) - Relates to apple/containerization#744. - Use the new `FilePathOps` utility functions. --- Sources/ContainerCommands/Image/ImageLoad.swift | 7 ++----- Sources/ContainerCommands/Image/ImageSave.swift | 7 ++----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Sources/ContainerCommands/Image/ImageLoad.swift b/Sources/ContainerCommands/Image/ImageLoad.swift index 07664ebc..a70d127e 100644 --- a/Sources/ContainerCommands/Image/ImageLoad.swift +++ b/Sources/ContainerCommands/Image/ImageLoad.swift @@ -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? diff --git a/Sources/ContainerCommands/Image/ImageSave.swift b/Sources/ContainerCommands/Image/ImageSave.swift index 3f42deba..ee886846 100644 --- a/Sources/ContainerCommands/Image/ImageSave.swift +++ b/Sources/ContainerCommands/Image/ImageSave.swift @@ -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?