BUG: processorMeshes removeFiles does not remove collated (fixes #2607)

ENH: extend rmDir to handle removal of empty directories only

- recursively remove directories that only contain other directories
  but no other contents. Treats dead links as non-content.
This commit is contained in:
Mark Olesen
2022-10-05 16:24:46 +02:00
parent 779a2ca084
commit d5cdc60a54
17 changed files with 313 additions and 224 deletions

View File

@ -98,35 +98,32 @@ Foam::processorFaMeshes::processorFaMeshes
void Foam::processorFaMeshes::removeFiles(const faMesh& mesh)
{
IOobject ioAddr
IOobject io
(
"procAddressing",
mesh.facesInstance(),
faMesh::meshSubDir,
mesh.thisDb(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false // not registered
mesh.thisDb()
);
// procAddressing
rm(ioAddr.objectPath());
fileHandler().rm(fileHandler().filePath(io.objectPath()));
// pointProcAddressing
ioAddr.rename("pointProcAddressing");
rm(ioAddr.objectPath());
io.rename("pointProcAddressing");
fileHandler().rm(fileHandler().filePath(io.objectPath()));
// edgeProcAddressing
ioAddr.rename("edgeProcAddressing");
rm(ioAddr.objectPath());
io.rename("edgeProcAddressing");
fileHandler().rm(fileHandler().filePath(io.objectPath()));
// faceProcAddressing
ioAddr.rename("faceProcAddressing");
rm(ioAddr.objectPath());
io.rename("faceProcAddressing");
fileHandler().rm(fileHandler().filePath(io.objectPath()));
// boundaryProcAddressing
ioAddr.rename("boundaryProcAddressing");
rm(ioAddr.objectPath());
io.rename("boundaryProcAddressing");
fileHandler().rm(fileHandler().filePath(io.objectPath()));
}