Skip to content

AbsolutePath.Exists should return true if the entity is a directory #171

@ForNeVeR

Description

@ForNeVeR

I've had this simple program:

open TruePath
open TruePath.SystemIo

let repoRoot = AbsolutePath __SOURCE_DIRECTORY__ / ".."

let folders = [|
        repoRoot / "TdLib.Api" / "Objects"
        repoRoot / "TdLib.Api" / "Functions"
    |]
    for folder in folders do
        if folder.Exists() then
            printfn $"Removing folder \"{folder.Value}\""
            folder.DeleteDirectoryRecursively()
        else printfn $"Nothing to clean in \"{folder.Value}\": folder doesn't exist."

And it broke because folder.Exists() doesn't check for directory existence, but only for files.

Let's have separate explicit methods ExistsFile() and ExistsDirectory() (in fact we already have the latter), and make Exists() to check the entity for existence without checking for its exact kind.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions