Skip to content

Singular createDirectory #280

Open
Open
@mgroth0

Description

@mgroth0

There only exists createDirectories but not a singular createDirectory. A singular createDirectory operation has the beneficial feature of a built in assertion that the parent folder already exists. Currently, I work round this with something like:

fun FileSystem.createDirectory(path: Path, mustCreate: Boolean = true) {
    check(exists(path.parent!!))
    createDirectories(path,mustCreate=mustCreate)
}

This is not ideal becasuse the operation now involves two IO instructions, when I would expect this to be a single IO instruction.

Is there a technical reason why this is difficult to implement, or is it by design?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions