Skip to content

Commit 8375d94

Browse files
committed
revert plugins path logic
1 parent 1709d58 commit 8375d94

3 files changed

Lines changed: 6 additions & 13 deletions

File tree

src/matlab.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export async function generateScript(workspaceDir: string, command: string): Pro
3333
const temporaryDirectory = await fs.mkdtemp(path.join(os.tmpdir(), "run_matlab_command-"));
3434

3535
const scriptPath = path.join(temporaryDirectory, scriptName + ".m");
36-
await fs.writeFile(scriptPath, script.prepare(command), {
36+
await fs.writeFile(scriptPath, script.cdAndCall(command), {
3737
encoding: "utf8",
3838
});
3939

src/script.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
11
// Copyright 2020-2025 The MathWorks, Inc.
22

3-
import * as path from "path";
4-
53
/**
6-
* Generate MATLAB command for changing directories, adding plugins to path and calling a command in it.
4+
* Generate MATLAB command for changing directories and calling a command in it.
75
*
86
* @param dir Directory to change to.
97
* @param command Command to run in directory.
108
* @returns MATLAB command.
119
*/
12-
export function prepare(command: string): string {
13-
const pluginsPath = path.join(__dirname, "plugins").replaceAll("'","''");
14-
return `cd(getenv('MW_ORIG_WORKING_FOLDER')); ` +
15-
`addpath('` + pluginsPath + `'); `
16-
+ command;
10+
export function cdAndCall(command: string): string {
11+
return `cd(getenv('MW_ORIG_WORKING_FOLDER')); ${command}`;
1712
}
1813

1914
/**

src/script.unit.test.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
// Copyright 2020-2025 The MathWorks, Inc.
22

33
import * as script from "./script";
4-
import * as path from "path";
54

65
describe("call generation", () => {
76
it("ideally works", () => {
87
// I know what your thinking
98
const testCommand = "disp('hello world')";
10-
const pluginsPath = path.join(__dirname, "plugins").replaceAll("'","''");
11-
const expectedString = `cd(getenv('MW_ORIG_WORKING_FOLDER')); addpath('` + pluginsPath + `'); ${testCommand}`;
9+
const expectedString = `cd(getenv('MW_ORIG_WORKING_FOLDER')); ${testCommand}`;
1210

13-
expect(script.prepare(testCommand)).toMatch(expectedString);
11+
expect(script.cdAndCall(testCommand)).toMatch(expectedString);
1412
});
1513
});
1614

0 commit comments

Comments
 (0)