MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / cleanUpCacheDiskStructure

Method cleanUpCacheDiskStructure

Engine/AppManagerPrivate.cpp:603–645  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

601} // AppManagerPrivate::checkForCacheDiskStructure
602
603void
604AppManagerPrivate::cleanUpCacheDiskStructure(const QString & cachePath, bool isTiled)
605{
606 /*re-create cache*/
607
608 QDir cacheFolder(cachePath);
609
610# if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
611 QtCompat::removeRecursively(cachePath);
612# else
613 if ( cacheFolder.exists() ) {
614 cacheFolder.removeRecursively();
615 }
616#endif
617 if ( !cacheFolder.exists() ) {
618 bool success = cacheFolder.mkpath( QChar::fromLatin1('.') );
619 if (!success) {
620 qDebug() << "Warning: cache directory" << cachePath << "could not be created";
621 }
622 }
623
624 QStringList etr = cacheFolder.entryList(QDir::NoDotAndDotDot);
625 // if not 256 subdirs, we re-create the cache
626 if (etr.size() < 256) {
627 Q_FOREACH (const QString &e, etr) {
628 cacheFolder.rmdir(e);
629 }
630 }
631 if (!isTiled) {
632 for (U32 i = 0x00; i <= 0xF; ++i) {
633 for (U32 j = 0x00; j <= 0xF; ++j) {
634 std::ostringstream oss;
635 oss << std::hex << i;
636 oss << std::hex << j;
637 std::string str = oss.str();
638 bool success = cacheFolder.mkdir( QString::fromUtf8( str.c_str() ) );
639 if (!success) {
640 qDebug() << "Warning: cache directory" << (cachePath.toStdString() + '/' + str).c_str() << "could not be created";
641 }
642 }
643 }
644 }
645}
646
647void
648AppManagerPrivate::setMaxCacheFiles()

Callers 2

restoreCacheFunction · 0.80

Calls 4

removeRecursivelyFunction · 0.85
mkdirMethod · 0.80
toStdStringMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected