Skip to content

[SR-15719] func writeFileContents(path:,bytes:) should have an option to create the parent directory #4361

Open
@abertelrud

Description

@abertelrud
Previous ID SR-15719
Radar None
Original Reporter @abertelrud
Type Task
Additional Detail from JIRA
Votes 0
Component/s Package Manager
Labels Task
Assignee None
Priority Medium

md5: 9052552b66dd7ea15028217d415b5f1f

Issue Description:

A lot of the SwiftPM unit tests use the ToolsSupportCore method `writeFileContents(_ path: AbsolutePath, body: (WritableByteStream) -> Void) throws`, which conveniently creates the parent directory of the file if needed.

But the core funnel method `func writeFileContents(_ path: AbsolutePath, bytes: ByteString)` does not have a way of creating the directory.

It would be useful to be able to create the directory from any of the variants of `func writeFileContents(_ path: AbsolutePath, bytes: ByteString)`, so this SR suggest adding a parameter to do that. It probably needs to default to false for compatibility, but that can be discussed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions