Skip to content

NIOFileSystem: createDirectory that doesn't fail if dir already exists #3404

@weissi

Description

@weissi

Every createDirectory call I have is wrapped in

        do {
            try await fileSystem.createDirectory(at: logsDir, withIntermediateDirectories: true)
        } catch let error as FileSystemError where error.code == .fileAlreadyExists {
            // ok
        }

I doubt this is even correct. What I want is:

  • Succeed if nothing exists
  • Succeed if a directory already exists at destination
  • Fail if a non-directory file exists at destination

Metadata

Metadata

Assignees

No one assigned

    Labels

    good first issueGood for newcomerskind/enhancementImprovements to existing feature.size/SSmall task. (A couple of hours of work.)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions