Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.8 KiB

  1. #include "stdinc.h"
  2. using std::ofstream;
  3. using std::basic_string;
  4. bool GenerateCatalogContents( const CPostbuildProcessListEntry& item )
  5. {
  6. wstring cdfOutputPath;
  7. wstring catalogName;
  8. ofstream cdfOutput;
  9. cdfOutputPath = item.getManifestPathOnly() + wstring(L"\\") + item.getManifestFileName() + wstring(L".cdf");
  10. catalogName = item.getManifestFileName().substr( 0, item.getManifestFileName().find_last_of(L'.') ) + wstring(L".cat");
  11. cdfOutput.open(ConvertWString(cdfOutputPath).c_str());
  12. if ( !cdfOutput.is_open() ) {
  13. wstringstream ss;
  14. ss << wstring(L"Can't open the output cdf file ") << cdfOutputPath;
  15. ReportError( ErrorFatal, ss );
  16. return false;
  17. }
  18. cdfOutput << "[CatalogHeader]" << endl;
  19. cdfOutput << "Name=" << ConvertWString(catalogName) << endl;
  20. cdfOutput << "ResultDir=" << ConvertWString(item.getManifestPathOnly()) << endl;
  21. cdfOutput << endl;
  22. cdfOutput << "[CatalogFiles]" << endl;
  23. cdfOutput << "<HASH>" << ConvertWString(item.getManifestFileName()) << "=" << ConvertWString(item.getManifestFileName()) << endl;
  24. cdfOutput << ConvertWString(item.getManifestFileName()) << "=" << ConvertWString(item.getManifestFileName()) << endl;
  25. cdfOutput.close();
  26. if ( g_GlobalParameters.m_CdfOutputPath.size() > 0 ) {
  27. ofstream cdflog;
  28. cdflog.open(ConvertWString(g_GlobalParameters.m_CdfOutputPath).c_str(), wofstream::app | wofstream::out);
  29. if ( !cdflog.is_open() )
  30. {
  31. wstringstream ss;
  32. ss << wstring(L"Can't open cdf logging file ") << g_GlobalParameters.m_CdfOutputPath;
  33. ReportError( ErrorWarning, ss );
  34. }
  35. else
  36. {
  37. cdflog << ConvertWString(cdfOutputPath) << endl;
  38. cdflog.close();
  39. }
  40. }
  41. return true;
  42. }