Source code of Windows XP (NT5)
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.

94 lines
2.9 KiB

  1. ########################
  2. # Cabinet Cache Manager
  3. ########################
  4. $RedistInfoLoc=$ARGV[0];
  5. $CabCacheTargetFile=$ARGV[1];
  6. $CabCacheFlag=$ARGV[2];
  7. $ProductTimeDate=$ARGV[3];
  8. $MyNTTREE=$ARGV[4];
  9. $Language=$ARGV[5];
  10. $LocalizedRoot=$ARGV[6];
  11. $RootDir=$ENV{DXROOT};
  12. $BuildType=$ENV{NTDEBUG};
  13. $AltSourceFiles=$ENV{_ALT_NTTREE};
  14. $MultiLocalizedDirectory="$LocalizedRoot\\multi";
  15. $LocalizedDirectory="$LocalizedRoot\\$Language";
  16. $BuildWarnMsg="nmake : warning CACMGR : ";
  17. $BuildErrMsg="nmake : error CACMGR : ";
  18. $WriteLockFile="wlfile.lck";
  19. open (WRITELOCK,">$WriteLockFile") || die "$BuildWrnMsg Time/Date process in use. Can't open $WriteLockFile";
  20. $Path="$RootDir\\public\\sdk\\lib\\placefil.txt";
  21. open(PLACEFIL, $Path) || die "$BuildErrorMsg Unable to open placefil.txt at ".$Path." for input\n";
  22. @LocalizedFiles =grep(m/;localize/, <PLACEFIL>);
  23. close (PLACEFIL);
  24. $FileName=substr($CabCacheTargetFile,rindex($CabCacheTargetFile,"\\")+1);
  25. open (REDISTFILES,$RedistInfoLoc) || die "$BuildErrorMsg Unable to open redistfiles.dat at $RedistInfoLoc for input\n";
  26. ($FileConfiguration)=grep(m/$FileName/ig, <REDISTFILES>);
  27. close (REDISTFILES);
  28. ($FileName, $SubPath, $RedistTimeDate, $Filters) = split /,/,$FileConfiguration,4;
  29. $RedistTimeDate=~s/^\s*(.*?)\s*$/$1/;
  30. $FileName=~s/^\s*(.*?)\s*$/$1/;
  31. $SubPath=~s/^\s*(.*?)\s*$/$1/;
  32. if (grep(m/$FileName/i, @LocalizedFiles))
  33. {
  34. # if ($Filters=~m/SINGLELANGUAGE/ig )
  35. if (!($Language eq "eng" && $FileName eq "dxdiag.exe"))
  36. {
  37. $SubPath=($Language ne "eng")?$LocalizedDirectory:$SubPath;
  38. } else {
  39. $SubPath=$MultiLocalizedDirectory;
  40. }
  41. }
  42. if ($FileName=~m/\.cat/i) {
  43. $SubPath=$SubPath."\\".$Language;
  44. }
  45. # if (($Filters=~m/SWITCHFILE/i) && !(grep(m/$FileName/i, @LocalizedFiles)))
  46. if (($Filters=~m/SWITCHFILE/i) && (!(grep(m/$FileName/i, @LocalizedFiles)) || ($Language eq "eng")))
  47. {
  48. if ($BuildType eq "" || $BuildType eq "ntsdnodbg")
  49. {
  50. if ($Filters=~m/SWITCHFILER/i){
  51. $OriginalFile=$MyNTTREE."\\".$SubPath."\\".$FileName;
  52. }
  53. if ($Filters=~m/SWITCHFILED/i){
  54. $OriginalFile=$AltSourceFiles."\\".$SubPath."\\".$FileName;
  55. }
  56. } else {
  57. if ($Filters=~m/SWITCHFILER/i){
  58. $OriginalFile=$AltSourceFiles."\\".$SubPath."\\".$FileName;
  59. }
  60. if ($Filters=~m/SWITCHFILED/i){
  61. $OriginalFile=$MyNTTREE."\\".$SubPath."\\".$FileName;
  62. }
  63. }
  64. } else {
  65. $OriginalFile=$MyNTTREE."\\".$SubPath."\\".$FileName;
  66. }
  67. if (-e $OriginalFile) {
  68. open (MAKEFLAG,">$CabCacheFlag") || die "$BuildErrMsg Problem creating flag file $CabCacheFlag";
  69. close (MAKEFLAG);
  70. } else {
  71. die "nmake : error : can not find the file to pack: $OriginalFile";
  72. }
  73. printf("\ncopying %s to \n %s\n\n",$OriginalFile, $CabCacheTargetFile);
  74. system "copy $OriginalFile,$CabCacheTargetFile";
  75. $TimeDateToUse=(($RedistTimeDate=~m/CURRENT DATE/i)||($RedistTimeDate eq ""))?$ProductTimeDate:$RedistTimeDate;
  76. system("touch /f /t $TimeDateToUse $CabCacheTargetFile\n");
  77. close (WRITELOCK);
  78. exit;