Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transferring ownership to subdirectories #72

Open
bgs99 opened this issue May 31, 2024 · 0 comments
Open

Transferring ownership to subdirectories #72

bgs99 opened this issue May 31, 2024 · 0 comments

Comments

@bgs99
Copy link
Collaborator

bgs99 commented May 31, 2024

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");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant