Skip to content

Transferring ownership to subdirectories #72

@bgs99

Description

@bgs99

It would be nice to have a solution for converting a subdirectory of the tmp::directory into a new tmp::directory that is not going to be deleted when its parent is destroyed.

Currently, the options are:

  1. tmp::directory::copy the subdirectory - which forces a recursive copy
  2. tmp::directory dir; fs::rename(tmpdir / "subdirectory", dir); - which is somewhat verbose and additionally requires handling of the cross-filesystem moves.
  3. Wrapping the subdirectory with the original tmp::directory to prevent its deletion - which has 0 overhead and does not seem to have hidden problems, but is extremely verbose.

I think the method analogous to tmp::directory::copy which moves the filesystem tree into the new temporary directory would be a good solution for this:

tmp::directory subdirectory = tmp::directory::moveFrom(tmpdir / "subdirectory");

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