Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit 2924534

Browse files
committed
folder can run again
1 parent a6d7ae1 commit 2924534

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

main.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,27 +68,27 @@ export default class PythonScripterPlugin extends Plugin {
6868
if (local_current_file_path === undefined) {
6969
local_current_file_path = "";
7070
}
71-
var abs_current_file_path = path.join(basePath, local_current_file_path);
72-
exec(`python ${filePath} ${basePath} ${abs_current_file_path}`, {cwd: this.pythonDirectory}, (error: any, stdout: any, stderr: any) => {
71+
exec(`python ${filePath} ${basePath} ${local_current_file_path.replace(/ /g, '\\ ')}`, {cwd: this.pythonDirectory}, (error: any, stdout: any, stderr: any) => {
7372
if (error) {
7473
new Notice(`Error executing script ${filePath}: ${error}`);
7574
return;
7675
}
7776
new Notice(`Script ` + fileName + ` output:\n${stdout}`);
7877
});
79-
} else if (stats.isDirectory()) {
78+
} else if (stats.isDirectory()) {
8079
var dir = path.join(filePath);
8180
var executable = path.join(".", filePath, "src", "main.py");
8281
var local_current_file_path = this.app.workspace.activeEditor?.file?.path;
8382
if (local_current_file_path === undefined) {
8483
local_current_file_path = "";
8584
}
86-
var abs_current_file_path = path.join(basePath, local_current_file_path);
87-
exec(`python ${executable} ${basePath} ${abs_current_file_path}`, {cwd: dir}, (error: any, stdout: any, stderr: any) => {
85+
console.log(`python ${filePath} ${basePath} ${local_current_file_path.replace(/ /g, '\\ ')}`)
86+
exec(`python ${path.join(filePath, "src", "main.py")} ${basePath} ${local_current_file_path.replace(/ /g, '\\ ')}`, {cwd: dir}, (error: any, stdout: any, stderr: any) => {
8887
if (error) {
8988
new Notice(`Error executing folder program: ${error}`);
9089
return;
9190
}
91+
new Notice(`output:\n${local_current_file_path}`);
9292
new Notice(`Script ` + fileName + " " + basePath + ` output:\n${stdout}`);
9393
});
9494
}

0 commit comments

Comments
 (0)