Skip to content

Introduce {bool exclusive = false} parameter to File.create({recursive}) method #49647

@aam

Description

@aam

Desktop OSs allow for a file to be created in exclusive mode enabling simple concurrency-serializing mechanism.

from https://man7.org/linux/man-pages/man2/open.2.html

       O_EXCL Ensure that this call creates the file: if this flag is
              specified in conjunction with O_CREAT, and pathname
              already exists, then open() fails with the error EEXIST.

https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/open-wopen

EEXIST | _O_CREAT and _O_EXCL flags specified, but filename already exists.

This currently is not available for Dart apps.
This can be fixed via new optional exclusive parameter to https://api.flutter.dev/flutter/dart-io/File/create.html:

Future<File>> create(
{bool recursive = false,
bool exclusive = false}
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.breaking-change-approvedlibrary-iotype-enhancementA request for a change that isn't a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions