Exemple #1
0
void
PackageManager::add(const std::string & thePaths) {
    AC_TRACE << "adding '" << thePaths << "'";
    std::vector<std::string> myPathVector;
    splitPaths(thePaths, myPathVector);
    AC_DEBUG << "adding " << myPathVector.size() << " packages";
    for (int i = myPathVector.size() - 1; i >= 0; i--) {
        std::string normalizedPath = normalizeDirectory(myPathVector[i], true);

        if (!fileExists(normalizedPath)) {
            AC_WARNING << "PackageManager: Package '" << normalizedPath << "' does not exist";
            continue;
        }

        if (isDirectory(normalizedPath)) {
            AC_DEBUG << "adding Directory '" << normalizedPath << "'";
            add(IPackagePtr(new DirectoryPackage(normalizedPath)));
            continue;
        } else {
            ConstMappedBlock myBlock(normalizedPath);
            // check zip file signature
            if (myBlock[0] == 0x50 && myBlock[1] == 0x4b && myBlock[2] == 0x03 && myBlock[3] == 0x04) {
                AC_DEBUG << "adding Zip '" << normalizedPath << "'";
                add(IPackagePtr(new ZipPackage(normalizedPath)));
            } else {
                AC_WARNING << "PackageManager: can not open package '" << normalizedPath << "'"
                            << ", not a directory and file type unknown.";
                AC_WARNING << "Sig is " << myBlock[0] << myBlock[1] << myBlock[2] << myBlock[3];
            }
        }
    }
}
Exemple #2
0
 void testCharStarBlock()
 {
     KDebug::Block myBlock(qPrintable(QString::fromLatin1("Block"))); // the char* goes out of scope
     func_void();
     deprecatedMethod();
 }