Skip to content

Commit cdd87ee

Browse files
committed
Added extra safety check
1 parent 3259322 commit cdd87ee

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

out/MatlabTerminal.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

out/MatlabTerminal.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/MatlabTerminal.ts

+4
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ export default class MatlabTerminal {
2121
vscode.window.showInformationMessage("File not found in workspace!");
2222
return;
2323
}
24+
if (!absFilePath.endsWith(".m")) {
25+
vscode.window.showInformationMessage("Trying to run a non-Matlab file!");
26+
return;
27+
}
2428
const relativeFilePath = "." + absFilePath.replace(this.workspaceDirectoryPath, "");
2529
if (!this.hasExecutedOnce) {
2630
this.terminal.sendText(`${this.matlabCommand} ${this.noSplashArg} ${this.noDesktopArg} -sd ${this.workspaceDirectoryPath} -r "run('${relativeFilePath}');"`);

0 commit comments

Comments
 (0)