@@ -64,18 +64,25 @@ export default class PythonScripterPlugin extends Plugin {
64
64
return ;
65
65
}
66
66
if ( stats . isFile ( ) ) {
67
- exec ( `python ${ filePath } ${ basePath } ` , { cwd : this . pythonDirectory } , ( error : any , stdout : any , stderr : any ) => {
67
+ var local_current_file_path = this . app . workspace . activeEditor ?. file ?. path ;
68
+ if ( local_current_file_path === undefined ) {
69
+ local_current_file_path = "" ;
70
+ }
71
+ exec ( `python ${ filePath } ${ basePath } \"${ local_current_file_path } \"` , { cwd : this . pythonDirectory } , ( error : any , stdout : any , stderr : any ) => {
68
72
if ( error ) {
69
73
new Notice ( `Error executing script ${ filePath } : ${ error } ` ) ;
70
74
return ;
71
75
}
72
-
73
76
new Notice ( `Script ` + fileName + ` output:\n${ stdout } ` ) ;
74
77
} ) ;
75
- } else if ( stats . isDirectory ( ) ) {
78
+ } else if ( stats . isDirectory ( ) ) {
76
79
var dir = path . join ( filePath ) ;
77
80
var executable = path . join ( "." , filePath , "src" , "main.py" ) ;
78
- exec ( `python ${ executable } ${ basePath } ` , { cwd : dir } , ( error : any , stdout : any , stderr : any ) => {
81
+ var local_current_file_path = this . app . workspace . activeEditor ?. file ?. path ;
82
+ if ( local_current_file_path === undefined ) {
83
+ local_current_file_path = "" ;
84
+ }
85
+ exec ( `python ${ path . join ( filePath , "src" , "main.py" ) } ${ basePath } \"${ local_current_file_path } \"` , { cwd : dir } , ( error : any , stdout : any , stderr : any ) => {
79
86
if ( error ) {
80
87
new Notice ( `Error executing folder program: ${ error } ` ) ;
81
88
return ;
0 commit comments