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:
parent
4082975330
commit
0ce2c8f4f4
1 changed files with 5 additions and 11 deletions
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue