给 7Z 增加解压后打开目录的功能

修改 7Zip CPP\7zip\UI\GUI\ExtractGUI.cpp ExtractGUI() 函数,在末尾增加一段代码:

  extracter.ArchivePaths = &archivePaths;
  extracter.ArchivePathsFull = &archivePathsFull;
  extracter.WildcardCensor = &wildcardCensor;
  extracter.Options = &options;
  #ifndef Z7_SFX
  extracter.HashBundle = hb;
  #endif

  extracter.IconID = IDI_ICON;

  RINOK(extracter.Create(title, hwndParent))
  messageWasDisplayed = extracter.ThreadFinishedOK && extracter.MessagesDisplayed;
  
  //LAB-Z_Debug_Start
  if (extracter.Result == S_OK && !options.TestMode && !options.OutputDir.IsEmpty())  
  {  
    FString outputDir = options.OutputDir;  
    NName::NormalizeDirPathPrefix(outputDir);  
      
    ShellExecute(NULL, L"explore", fs2us(outputDir), NULL, NULL, SW_SHOWNORMAL);  
  }
  //LAB-Z_Debug_End

  return extracter.Result;
}

重新编译,之后将编译生成的 7zG.exe 拷贝覆盖到之前的 7z 安装目录下,使用右键解压的时候就能自动打开解压目录了。

修改后的代码:

基于26.01 源代码修改后编译生成的 7zG.exe:

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注