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:
tmp::directory::copy the subdirectory - which forces a recursive copy
tmp::directory dir; fs::rename(tmpdir / "subdirectory", dir); - which is somewhat verbose and additionally requires handling of the cross-filesystem moves.
- 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");
It would be nice to have a solution for converting a subdirectory of the
tmp::directoryinto a newtmp::directorythat is not going to be deleted when its parent is destroyed.Currently, the options are:
tmp::directory::copythe subdirectory - which forces a recursive copytmp::directory dir; fs::rename(tmpdir / "subdirectory", dir);- which is somewhat verbose and additionally requires handling of the cross-filesystem moves.tmp::directoryto 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::copywhich moves the filesystem tree into the new temporary directory would be a good solution for this:tmp::directory subdirectory = tmp::directory::moveFrom(tmpdir / "subdirectory");