Пример #1
0
void InstallationManager::mapToArchive(const DirectoryTree::Node *node, std::wstring path, FileData * const *data)
{
  if (path.length() > 0) {
    // when using a long windows path (starting with \\?\) we apparently can have redundant
    // . components in the path. This wasn't a problem with "regular" path names.
    if (path == L".") {
      path.clear();
    } else {
      path.append(L"\\");
    }
  }

  for (DirectoryTree::const_leaf_iterator iter = node->leafsBegin(); iter != node->leafsEnd(); ++iter) {
    std::wstring temp = path + iter->getName().toStdWString();
    data[iter->getIndex()]->addOutputFileName(temp.c_str());
  }

  for (DirectoryTree::const_node_iterator iter = node->nodesBegin(); iter != node->nodesEnd(); ++iter) {
    std::wstring temp = path + (*iter)->getData().name.toStdWString();
    if ((*iter)->getData().index != -1) {
      data[(*iter)->getData().index]->addOutputFileName(temp.c_str());
    }
    mapToArchive(*iter, temp, data);
  }
}
bool InstallerFomod::isArchiveSupported(const DirectoryTree &tree) const
{
  const DirectoryTree *fomodDir = findFomodDirectory(&tree);
  if (fomodDir != nullptr) {
    for (DirectoryTree::const_leaf_iterator fileIter = fomodDir->leafsBegin();
         fileIter != fomodDir->leafsEnd(); ++fileIter) {
      if (fileIter->getName() == "ModuleConfig.xml") {
        return true;
      }
    }
  }
  return false;
}
Пример #3
0
bool InstallationManager::isSimpleArchiveTopLayer(const DirectoryTree::Node *node, bool bainStyle)
{
  // see if there is at least one directory that makes sense on the top level
  for (DirectoryTree::const_node_iterator iter = node->nodesBegin(); iter != node->nodesEnd(); ++iter) {
    if ((bainStyle && InstallationTester::isTopLevelDirectoryBain((*iter)->getData().name)) ||
        (!bainStyle && InstallationTester::isTopLevelDirectory((*iter)->getData().name))) {
      qDebug("%s on the top level", (*iter)->getData().name.toUtf8().constData());
      return true;
    }
  }

  // see if there is a file that makes sense on the top level
  for (DirectoryTree::const_leaf_iterator iter = node->leafsBegin(); iter != node->leafsEnd(); ++iter) {
    if (InstallationTester::isTopLevelSuffix(iter->getName())) {
      return true;
    }
  }
  return false;
}