| 601 | } // AppManagerPrivate::checkForCacheDiskStructure |
| 602 | |
| 603 | void |
| 604 | AppManagerPrivate::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 | |
| 647 | void |
| 648 | AppManagerPrivate::setMaxCacheFiles() |
no test coverage detected