Skip to content

Commit

Permalink
Add check if mpm already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Vahila committed Feb 13, 2025
1 parent 250e572 commit 7e9161d
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/mpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as exec from "@actions/exec";
import * as tc from "@actions/tool-cache";
import {rmRF} from "@actions/io";
import * as path from "path";
import * as fs from 'fs';
import * as matlab from "./matlab";
import properties from "./properties.json";

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

if (platform !== "win32") {
const exitCode = await exec.exec(`chmod +x "${mpm}"`);
if (exitCode !== 0) {
return Promise.reject(Error("Unable to set up mpm."));
if (platform !== "win32") {
const exitCode = await exec.exec(`chmod +x "${mpm}"`);
if (exitCode !== 0) {
return Promise.reject(Error("Unable to set up mpm."));
}
}

return mpm;
}
else{
return mpmDest
}
return mpm
}

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

0 comments on commit 7e9161d

Please sign in to comment.