Esempio n. 1
0
int
main(int argc, char **argv)
{
  Args args(argc, argv, "PATH");
  const auto path = args.ExpectNextPath();
  args.ExpectEnd();

  Error error;
  FileLineReaderA reader(path, error);
  if (reader.error()) {
    fprintf(stderr, "%s\n", error.GetMessage());
    return EXIT_FAILURE;
  }

  FileRepository repository;

  if (!ParseFileRepository(repository, reader)) {
    fprintf(stderr, "Failed to parse file\n");
    return EXIT_FAILURE;
  }

  for (auto i = repository.begin(), end = repository.end(); i != end; ++i) {
    const auto &file = *i;
    printf("file '%s' '%s' area='%s' type=%u\n",
           file.GetName(), file.GetURI(), file.GetArea(),
           (unsigned)file.type);
  }

  return EXIT_SUCCESS;
}
Esempio n. 2
0
void
ManagedFileListWidget::LoadRepositoryFile()
{
#ifdef HAVE_DOWNLOAD_MANAGER
  mutex.Lock();
  repository_modified = false;
  repository_failed = false;
  mutex.Unlock();
#endif

  repository.Clear();

  const auto path = LocalPath(_T("repository"));
  FileLineReaderA reader(path, IgnoreError());
  if (reader.error())
    return;

  ParseFileRepository(repository, reader);
}