@@ -68,27 +68,27 @@ export default class PythonScripterPlugin extends Plugin {
68
68
if ( local_current_file_path === undefined ) {
69
69
local_current_file_path = "" ;
70
70
}
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 ) => {
73
72
if ( error ) {
74
73
new Notice ( `Error executing script ${ filePath } : ${ error } ` ) ;
75
74
return ;
76
75
}
77
76
new Notice ( `Script ` + fileName + ` output:\n${ stdout } ` ) ;
78
77
} ) ;
79
- } else if ( stats . isDirectory ( ) ) {
78
+ } else if ( stats . isDirectory ( ) ) {
80
79
var dir = path . join ( filePath ) ;
81
80
var executable = path . join ( "." , filePath , "src" , "main.py" ) ;
82
81
var local_current_file_path = this . app . workspace . activeEditor ?. file ?. path ;
83
82
if ( local_current_file_path === undefined ) {
84
83
local_current_file_path = "" ;
85
84
}
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 ) => {
88
87
if ( error ) {
89
88
new Notice ( `Error executing folder program: ${ error } ` ) ;
90
89
return ;
91
90
}
91
+ new Notice ( `output:\n${ local_current_file_path } ` ) ;
92
92
new Notice ( `Script ` + fileName + " " + basePath + ` output:\n${ stdout } ` ) ;
93
93
} ) ;
94
94
}
0 commit comments