Skip to content

Add Dir::create_new_file that returns an error if the file already exists #31

@avsaase

Description

@avsaase

Hi,

Thanks for making this library. I'm using it in a personal project and I find it generally very nice to work with.

In my project I need to create sequentially numbered files like 0000.log, 0001.log, etc, one per boot. When a given file name already exists I need to create the file with the next number. Dir::create_file opens the file if it already exists. It would very convenient to have a create_new_file that returns an error when the file already exists. This way I could create a new file in a loop, incrementing the file number until it succeeds.

I haven't looked in detail yet what it would take to implement this but I did see there is already a suitable error variant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions