@@ -25,6 +25,7 @@ const core = __nccwpck_require__(2186);
25
25
const io = __nccwpck_require__(7436);
26
26
const tools = __nccwpck_require__(7784);
27
27
const path = __nccwpck_require__(1017);
28
+ const fs = __nccwpck_require__(7147);
28
29
const semver_1 = __nccwpck_require__(1383);
29
30
const catalog = __nccwpck_require__(5284);
30
31
const shared = __nccwpck_require__(6946);
@@ -261,16 +262,36 @@ class ToolsGetter {
261
262
restoreCache(outPath, key) {
262
263
return cache.restoreCache([outPath], key.toString());
263
264
}
265
+ extract(archiveSuffix, downloaded, outputPath) {
266
+ return __awaiter(this, void 0, void 0, function* () {
267
+ try {
268
+ yield extractFunction[archiveSuffix](downloaded, outputPath);
269
+ }
270
+ catch (exception) {
271
+ // Fix up the path for https://github.com/actions/toolkit/issues/1179
272
+ if (process.platform === 'win32') {
273
+ const zipExtension = ".zip";
274
+ if (path.extname(downloaded) !== zipExtension) {
275
+ const downloadedZip = downloaded + zipExtension;
276
+ fs.renameSync(downloaded, downloadedZip);
277
+ return yield extractFunction[archiveSuffix](downloadedZip, outputPath);
278
+ }
279
+ }
280
+ throw exception;
281
+ }
282
+ return downloaded;
283
+ });
284
+ }
264
285
downloadTools(cmakePackage, ninjaPackage, outputPath) {
265
286
return __awaiter(this, void 0, void 0, function* () {
266
287
let outPath;
267
288
yield core.group("Downloading and extracting CMake", () => __awaiter(this, void 0, void 0, function* () {
268
289
const downloaded = yield tools.downloadTool(cmakePackage.url);
269
- yield extractFunction[ cmakePackage.dropSuffix]( downloaded, outputPath);
290
+ yield this.extract( cmakePackage.dropSuffix, downloaded, outputPath);
270
291
}));
271
292
yield core.group("Downloading and extracting Ninja", () => __awaiter(this, void 0, void 0, function* () {
272
293
const downloaded = yield tools.downloadTool(ninjaPackage.url);
273
- yield extractFunction[ ninjaPackage.dropSuffix]( downloaded, outputPath);
294
+ yield this.extract( ninjaPackage.dropSuffix, downloaded, outputPath);
274
295
}));
275
296
});
276
297
}
0 commit comments