Skip to content

Update container copy to use FilePath#1580

Merged
jglogan merged 1 commit into
apple:mainfrom
JaewonHur:use-file-path-cp
May 20, 2026
Merged

Update container copy to use FilePath#1580
jglogan merged 1 commit into
apple:mainfrom
JaewonHur:use-file-path-cp

Conversation

@JaewonHur
Copy link
Copy Markdown
Contributor

@JaewonHur JaewonHur commented May 20, 2026

Replace URL with FilePath in container copy (#1557).
In addition, make copyIn/copyOut API to use String for path as we need to preserve the trailing slash to the LinuxContainer.copy---i.e., this trailing slash is used in LinuxContainer.copy to determine copy behavior.

@github-actions github-actions Bot added the cli label May 20, 2026
@github-actions
Copy link
Copy Markdown

Code Coverage

Tier Line Coverage
Unit 33.65%
Integration 19.97%
Combined 53.06%

}
let finalDest = destPath.appending(lastComponent)
try await client.copyOut(id: id, source: path, destination: finalDest.string)
} else if localPath.hasSuffix("/") {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note, when Swift brings FilePath into its standard library, there'll be a hasTrailingSeparator property.

https://github.com/swiftlang/swift-evolution/blob/main/proposals/0529-filepath-in-stdlib.md#trailing-separators

let srcURL = URL(fileURLWithPath: path)
let destURL = URL(fileURLWithPath: localPath).standardizedFileURL
let srcPath = FilePath(path)
let destPath = FilePath((localPath as NSString).standardizingPath)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let destPath = FilePath((localPath as NSString).standardizingPath)
// TODO - extract to utility function without NSString in ContainerizationOS, apple/containerization#744
let destPath = FilePath((localPath as NSString).standardizingPath)

}
case (.local(let localPath), .container(let id, let path)):
let srcURL = URL(fileURLWithPath: localPath).standardizedFileURL
let srcPath = FilePath((localPath as NSString).standardizingPath)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let srcPath = FilePath((localPath as NSString).standardizingPath)
// TODO - extract to utility function in ContainerizationOS, apple/containerization#744
let srcPath = FilePath((localPath as NSString).standardizingPath)

@jglogan
Copy link
Copy Markdown
Contributor

jglogan commented May 20, 2026

lgtm, I'll add the TODO comments in my next follow-up commit on container.

@jglogan jglogan merged commit df35f79 into apple:main May 20, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants