From 3e3aecd6b6275b302324c3a32ffc28b4f9dc5ae0 Mon Sep 17 00:00:00 2001 From: Kevin Stillhammer Date: Sat, 24 Aug 2024 09:20:02 +0200 Subject: [PATCH] On windows extracting the zip does not create an intermediate directory --- dist/setup/index.js | Bin 3573908 -> 3573542 bytes src/download/download-latest.ts | 4 ++-- src/download/download-version.ts | 27 ++++++--------------------- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index 51b882c16b984c9670c319b2c29662af05f80a04..3c46b40ab30791da5943bea582e0ddc337e33d49 100644 GIT binary patch delta 378 zcmbu(yDvjg90%~+>#9DfM_bh6w58q-ss@9E(Q;!mNp5;hxPyD;_E3+3;VTkD6Vc?i zior%YNIDu!;y>tQ>TWf;9sC7`&+z>&-*4@%sXbMj+7&eD=zxJv1ki;bLI@**C}QYF z58~)WANnzX1d>Q$5JMP78Y39R7{ qXM$mRsA*mF719HAD|nPXclhc}OK{(kZ`rrvEBM-dvC$H1FS%cI`-zGG delta 520 zcmZvX%}N4c6o#3crbhd3%KrOIOD*&3p9rF$TC~awC`iWsRnrLxiTtZ=%; z7iHBraO}A57)e^*;7j!W>Q(7E!8?D=CyJUflrqysR#@dtBb{Vrd8i^>HEnwI)M^xa zk(IR-E8`d$C(Eo9tE@0_i=jJ~oo9i=N>>Pv7DS`uAKkIcOeh#(!SK;G`HEUc=`)HH zHFtk*|Nk3u`+ve`s>7=zOM9iPvQt$W`Oai7o!oge`grx$|2#iQ+s`gHU0+Fc^r_Y; gG_Ugpx{q<+`MS;p6M{*>lwevgBbY6$>vQk^Z}T6vv;Y7A diff --git a/src/download/download-latest.ts b/src/download/download-latest.ts index b7c4a97..3dcad7a 100644 --- a/src/download/download-latest.ts +++ b/src/download/download-latest.ts @@ -29,8 +29,8 @@ export async function downloadLatest( let uvExecutablePath: string let uvDir: string if (platform === 'pc-windows-msvc') { - const extractedDir = await tc.extractZip(downloadPath) - uvDir = path.join(extractedDir, artifact) + uvDir = await tc.extractZip(downloadPath) + // On windows extracting the zip does not create an intermediate directory uvExecutablePath = path.join(uvDir, 'uv.exe') } else { const extractedDir = await tc.extractTar(downloadPath) diff --git a/src/download/download-version.ts b/src/download/download-version.ts index 645d329..33eb09c 100644 --- a/src/download/download-version.ts +++ b/src/download/download-version.ts @@ -5,11 +5,6 @@ import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils' import {Architecture, Platform} from '../utils/platforms' import {validateChecksum} from './checksum/checksum' -import * as fs from 'fs' -import * as util from 'util' - -const readdir = util.promisify(fs.readdir) - export function tryGetFromToolCache( arch: Architecture, version: string @@ -43,24 +38,14 @@ export async function downloadVersion( ) await validateChecksum(checkSum, downloadPath, arch, platform, version) - let extractedDir: string + let uvDir: string if (platform === 'pc-windows-msvc') { - extractedDir = await tc.extractZip(downloadPath) - const files = await readdir(extractedDir) - core.info( - `Contents of extracted directory ${extractedDir}: ${files.join(', ')}` - ) - const uvDir = path.join(extractedDir, artifact) - const uvfiles = await readdir(uvDir) - core.info(`Contents of directory ${uvDir}: ${uvfiles.join(', ')}`) + uvDir = await tc.extractZip(downloadPath) + // On windows extracting the zip does not create an intermediate directory } else { - extractedDir = await tc.extractTar(downloadPath) + const extractedDir = await tc.extractTar(downloadPath) + uvDir = path.join(extractedDir, artifact) } - return await tc.cacheDir( - path.join(extractedDir, artifact), - TOOL_CACHE_NAME, - version, - arch - ) + return await tc.cacheDir(uvDir, TOOL_CACHE_NAME, version, arch) }