Skip to content

Commit

Permalink
Delete mpm file if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Vahila committed Feb 18, 2025
1 parent 2b689a9 commit f17c71c
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/mpm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,25 @@ 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}`);
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."));
}
// Delete mpm file if it exists
if (fs.existsSync(mpmDest)) {
try {
fs.unlinkSync(mpmDest);
} catch (err) {
return Promise.reject(Error(`Failed to delete existing mpm file: ${err}`));
}

return mpm;
}
else{
return 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."));
}
}
return mpm
}

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

0 comments on commit f17c71c

Please sign in to comment.