Skip to content

Commit 7e9161d

Browse files
committed
Add check if mpm already exists
1 parent 250e572 commit 7e9161d

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

src/mpm.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import * as exec from "@actions/exec";
44
import * as tc from "@actions/tool-cache";
55
import {rmRF} from "@actions/io";
66
import * as path from "path";
7+
import * as fs from 'fs';
78
import * as matlab from "./matlab";
89
import properties from "./properties.json";
910

@@ -37,15 +38,21 @@ export async function setup(platform: string, architecture: string): Promise<str
3738
return Promise.reject(Error("Unable to find runner temporary directory."));
3839
}
3940
let mpmDest = path.join(runner_temp, `mpm${ext}`);
40-
let mpm: string = await tc.downloadTool(mpmUrl, mpmDest);
41+
if (!fs.existsSync(mpmDest)){
42+
let mpm: string = await tc.downloadTool(mpmUrl, mpmDest);
4143

42-
if (platform !== "win32") {
43-
const exitCode = await exec.exec(`chmod +x "${mpm}"`);
44-
if (exitCode !== 0) {
45-
return Promise.reject(Error("Unable to set up mpm."));
44+
if (platform !== "win32") {
45+
const exitCode = await exec.exec(`chmod +x "${mpm}"`);
46+
if (exitCode !== 0) {
47+
return Promise.reject(Error("Unable to set up mpm."));
48+
}
4649
}
50+
51+
return mpm;
52+
}
53+
else{
54+
return mpmDest
4755
}
48-
return mpm
4956
}
5057

5158
export async function install(mpmPath: string, release: matlab.Release, products: string[], destination: string) {

0 commit comments

Comments
 (0)