Beispiel #1
0
void CollectFiles(const char *basepath)
{
    FindData fd;
	char findspec[256], path[256];
    
	sprintf(findspec, "%s*", basepath);
	if (!FindFile_FindFirst(&fd, findspec))
	{
		// The first file found!
		do 
		{
			if (!Str_Compare(&fd.name, ".") || !Str_Compare(&fd.name, ".."))
				continue;
            
			sprintf(path, "%s%s", basepath, Str_Text(&fd.name));
			if (fd.attrib & A_SUBDIR)
			{
				CollectFiles(path);
			}
			else
			{
				NewFile(path, fd.size);
			}
		} 
		while (!FindFile_FindNext(&fd));
	}
    FindFile_Finish(&fd);
}
Beispiel #2
0
void runJetQA(TString list = "output.list", TString jetTreeName = "akPu3PFJetAnalyzer10", Int_t startEntry = 0, Int_t maxEvents = -1,  size_t startFile = 0, size_t nfiles = 0, Int_t jobNumber = 0, Int_t etaBin = 0) {

  std::vector<std::string> urls = CollectFiles(list);
  
  //Run analysis
  anaJetQA(urls, jetTreeName, startEntry, maxEvents,startFile,nfiles,jobNumber,etaBin);

}
void ReflectionParser::Parse(void)
{
  tStringList filesList;
  std::string moduleFile;
  CollectFiles(m_options.inputPath, filesList);

  m_sourceCache = new SourceCache(m_options.buildDirectory, m_options.targetName);
  m_sourceCache->Load();
  m_sourceCache->CheckGenerator(m_options.generatorPath);

  // ensure that output directory exist
  boost::filesystem::create_directory(boost::filesystem::path(m_options.outputPath));

  for (tStringList::const_iterator it = filesList.begin(); it != filesList.end(); ++it)
  {
    try
    {
      // if contains module, then process it later
      if (!ProcessFile(*it))
      {
        if (!moduleFile.empty())
        {
          EMIT_ERROR("You couldn't implement two module classes in one module");
        }

        moduleFile = *it;
      }
    }
    catch (Exception e)
    {
      EMIT_ERROR(e.GetDescription() << " in " << *it);
    }
  }

  try
  {
    if (!moduleFile.empty())
      ProcessFile(moduleFile, true);
  }
  catch (Exception e)
  {
    EMIT_ERROR(e.GetDescription() << " in " << moduleFile);
  }

  m_sourceCache->Save();
}
Beispiel #4
0
UINT Collect_Function2(LPVOID pParam)
{
	CSingleLock Lock1(&(MAINAPP->StopMutex)); 
	Lock1.Lock();
	MAINAPP->StopThread=AfxBeginThread(Function1,NULL);	
	int i; CString Path;

	for(i=0;i<MAINAPP->Directories.GetSize();i++)
	{
		Path=MAINAPP->Directories[i]; CStringArray *t=MAINAPP->AllFiles[i];
		CollectFiles(Path,*t);				
		delete t;	
	}
	MAINAPP->AllFiles.RemoveAll();
	Lock1.Unlock();
	return 0;
}
Beispiel #5
0
int main(int argc, char **argv)
{
	char *wadfile;
	char *prefix = "";
	FILE *file;
	wadinfo_t hdr;
	lumpinfo_t info;
	fname_t *it;
	int c;
	char lumpbase[4];
	int direc_size, direc_offset;

	PrintBanner();
	if (argc < 2 || argc > 3)
	{
		PrintUsage();
		return 0;
	}
	wadfile = argv[1];
	if (argc > 2) prefix = argv[2];

    srand((unsigned int)time(0));
	rand();
	rand();

	// First compile the list of all file names.
	InitList();
	printf("Collecting files...\n");
	CollectFiles("");	
	printf("Creating WAD file %s...\n", wadfile);
	if ((file = fopen(wadfile, "wb")) == NULL)
	{
		printf("Couldn't open %s.\n", wadfile);
		perror("Error");
		goto stop_now;
	}

	// The header.
	hdr.identification[0] = 'P';
	hdr.identification[1] = 'W';
	hdr.identification[2] = 'A';
	hdr.identification[3] = 'D';
	hdr.numlumps = CountList() + 1;
	hdr.infotableofs = 0; // We've no idea yet.
	fwrite(&hdr, sizeof(hdr), 1, file);

	// Write all the files.
	sprintf(lumpbase, "%c%c", 'A' + rand() % 26, 'A' + rand() % 26);
	for (it = root.next, c = 0; it != &root; it = it->next, c++)
	{
		it->offset = ftell(file);
		if (!CopyToStream(file, it)) 
		{
			perror(it->path);
			goto stop_now;
		}
		printf("%s\n", it->path);
		sprintf(it->lump, "__%s%04X", lumpbase, c);			
	}

	// Write DD_DIREC. 
	direc_offset = ftell(file);
	for (it = root.next; it != &root; it = it->next)
		fprintf(file, "%s %s%s\n", it->lump, prefix, it->path);
	direc_size = ftell(file) - direc_offset;
	
	// Time to write the info table.
	hdr.infotableofs = ftell(file);
	for (it = root.next, c = 0; it != &root; it = it->next, c++)
	{
		memset(&info, 0, sizeof(info));
		info.filepos = it->offset;
		info.size = it->size;
		memcpy(info.name, it->lump, 8);
		fwrite(&info, sizeof(info), 1, file);
	}
	// Finally DD_DIREC's entry.
	info.filepos = direc_offset;
	info.size = direc_size;
	strncpy(info.name, "DD_DIREC", 8);
	fwrite(&info, sizeof(info), 1, file);

	// Rewrite the header.
	rewind(file);
	fwrite(&hdr, sizeof(hdr), 1, file);
	
	// We're done!
	fclose(file);
stop_now:
	DestroyList();
	return 0;
}