@@ -8,7 +8,7 @@ var archiver = require('archiver');
88
99const deleteDir = ( path : string ) => tl . exist ( path ) && tl . rmRF ( path ) ;
1010
11- const extractWindowsZip = async ( fromFile : string , toDir : string , usePowerShell ?: boolean ) => {
11+ const extractWindowsZip = async ( fromFile : string , toDir : string , usePowerShell ?: boolean ) => {
1212 let forceUsePSUnzip : string = process . env [ 'ADO_FORCE_USE_PSUNZIP' ] || 'false'
1313 tl . debug ( `ADO_FORCE_USE_PSUNZIP = '${ forceUsePSUnzip } '` )
1414 if ( forceUsePSUnzip . toLowerCase ( ) === 'true' ) {
@@ -59,7 +59,7 @@ const extractUsingPowerShell = async (fromFile: string, toDir: string) => {
5959 . arg ( '-NonInteractive' )
6060 . arg ( '-Command' )
6161 . arg ( command ) ;
62-
62+
6363 let options = < tr . IExecOptions > {
6464 failOnStdErr : false ,
6565 errStream : process . stdout ,
@@ -87,8 +87,16 @@ const extractUsingPowerShell = async (fromFile: string, toDir: string) => {
8787}
8888
8989const extractUsing7zip = async ( fromFile : string , toDir : string ) => {
90- tl . debug ( 'Using 7zip tool for extracting' ) ;
91- var win7zipLocation = path . join ( __dirname , '7zip/7zip/7z.exe' ) ;
90+ let win7zipLocation : string ;
91+
92+ if ( tl . getPipelineFeature ( "Use7zV2409InWebDeploymentCommonPackage" ) ) {
93+ win7zipLocation = path . join ( __dirname , '7zip24/7zip/7z.exe' ) ;
94+ } else {
95+ win7zipLocation = path . join ( __dirname , '7zip/7zip/7z.exe' ) ;
96+ }
97+
98+ tl . debug ( `Using 7zip tool from ${ win7zipLocation } for extracting` ) ;
99+
92100 await tl . tool ( win7zipLocation )
93101 . arg ( [ 'x' , `-o${ toDir } ` , fromFile ] )
94102 . exec ( ) ;
@@ -104,14 +112,14 @@ const extractUsingUnzip = async (fromFile: string, toDir: string) => {
104112
105113export async function unzip ( zipFileLocation : string , unzipDirLocation : string ) {
106114 deleteDir ( unzipDirLocation ) ;
107-
115+
108116 const isWin = tl . getPlatform ( ) === tl . Platform . Windows ;
109117 tl . debug ( 'windows platform: ' + isWin ) ;
110118
111- tl . debug ( 'extracting ' + zipFileLocation + ' to ' + unzipDirLocation ) ;
119+ tl . debug ( 'extracting ' + zipFileLocation + ' to ' + unzipDirLocation ) ;
112120 if ( isWin ) {
113121 await extractWindowsZip ( zipFileLocation , unzipDirLocation ) ;
114- }
122+ }
115123 else {
116124 await extractUsingUnzip ( zipFileLocation , unzipDirLocation ) ;
117125 }
0 commit comments