Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

(FileInfo|DirectoryInfo).Copy() mutates the instance's path #526

@mlaily

Description

@mlaily
FileInfo x = new FileInfo("a");
x.Copy("b"); // <-- returns a new FileInfo with the path "b", and also mutate x so its path is now "b"
x.Delete(); // Boom you lost your copy ("b"), but "a" is still there!

It seems intended but while I can see how this is the right behaviour for Move(), I can't follow the reasoning for Copy(). Besides, System.IO.*Info.Copy() don't mutate their instances (There is a discrepancy there between System.IO and AlphaFS).

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