wsd: reuse file and directory cleanup helpers

Change-Id: I41d681347070245e411e359af57383e323f297ce
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This commit is contained in:
Ashod Nakashian 2020-11-29 17:25:57 -05:00 committed by Ashod Nakashian
parent 4082975330
commit 0ce2c8f4f4

View file

@ -2468,17 +2468,11 @@ ConvertToBroker::~ConvertToBroker()
void ConvertToBroker::removeFile(const std::string &uriOrig)
{
if (!uriOrig.empty())
{
try {
// Remove source file and directory
Poco::Path path = uriOrig;
Poco::File(path).remove();
Poco::File(path.makeParent()).remove();
} catch (const std::exception &ex) {
LOG_ERR("Error while removing conversion temporary: '" << uriOrig << "' - " << ex.what());
}
}
// Remove and report errors on failure.
FileUtil::removeFile(uriOrig);
const std::string dir = Poco::Path(uriOrig).parent().toString();
if (FileUtil::isEmptyDirectory(dir))
FileUtil::removeFile(dir);
}
void ConvertToBroker::setLoaded()