@@ -11,16 +11,21 @@ import { getOSType, OSType } from '../../common/utils/platform';
11
11
12
12
const [ executable , binName ] = getOSType ( ) === OSType . Windows ? [ 'python.exe' , 'Scripts' ] : [ 'python' , 'bin' ] ;
13
13
14
+ /**
15
+ * @param baseDir The base directory from which watch paths are to be derived.
16
+ * @param callback The listener function will be called when the event happens.
17
+ * @param executableSuffixGlob Glob which represents suffix of the full executable file path to watch.
18
+ */
14
19
export function watchLocationForPythonBinaries (
15
20
baseDir : string ,
16
21
callback : ( type : FileChangeType , absPath : string ) => void ,
17
- executableGlob : string = executable ,
22
+ executableSuffixGlob : string = executable ,
18
23
) : Disposable {
19
- const patterns = [ executableGlob , `*/${ executableGlob } ` , `*/${ binName } /${ executableGlob } ` ] ;
24
+ const patterns = [ executableSuffixGlob , `*/${ executableSuffixGlob } ` , `*/${ binName } /${ executableSuffixGlob } ` ] ;
20
25
const disposables : Disposable [ ] = [ ] ;
21
26
for ( const pattern of patterns ) {
22
27
disposables . push ( watchLocationForPattern ( baseDir , pattern , ( type : FileChangeType , e : string ) => {
23
- const isMatch = minimatch ( e , path . join ( '**' , executableGlob ) , { nocase : getOSType ( ) === OSType . Windows } ) ;
28
+ const isMatch = minimatch ( e , path . join ( '**' , executableSuffixGlob ) , { nocase : getOSType ( ) === OSType . Windows } ) ;
24
29
if ( ! isMatch ) {
25
30
// When deleting the file for some reason path to all directories leading up to python are reported
26
31
// Skip those events
0 commit comments