@@ -55,20 +55,28 @@ export class LocalWidgetScriptSourceProvider implements IWidgetScriptSourceProvi
55
55
56
56
const validFiles = files . filter ( ( file ) => {
57
57
// Should be of the form `<widget module>/index.js`
58
- const parts = file . split ( '/' ) ; // On windows this uses the unix separator too.
58
+ let parts = file . split ( '/' ) ; // On windows this uses the unix separator too.
59
+ if ( parts . length === 1 ) {
60
+ // Fall back if search API changes and returns results with OS path sep.
61
+ parts = file . split ( '\\' ) ;
62
+ }
59
63
if ( parts . length !== 2 ) {
60
- traceError ( ' Incorrect file found when searching for nnbextension entrypoints' ) ;
64
+ traceError ( ` Incorrect file found when searching for nnbextension entrypoints ${ file } ` ) ;
61
65
return false ;
62
66
}
63
67
return true ;
64
68
} ) ;
65
69
66
70
const mappedFiles = validFiles . map ( async ( file ) => {
67
71
// Should be of the form `<widget module>/index.js`
68
- const parts = file . split ( '/' ) ;
72
+ let parts = file . split ( '/' ) ; // On windows this uses the unix separator too.
73
+ if ( parts . length === 1 ) {
74
+ // Fall back if search API changes and returns results with OS path sep.
75
+ parts = file . split ( '\\' ) ;
76
+ }
69
77
const moduleName = parts [ 0 ] ;
70
78
71
- const fileUri = Uri . file ( path . join ( nbextensionsPath , file ) ) ;
79
+ const fileUri = Uri . file ( path . join ( nbextensionsPath , moduleName , parts [ 1 ] ) ) ;
72
80
const scriptUri = ( await this . localResourceUriConverter . asWebviewUri ( fileUri ) ) . toString ( ) ;
73
81
// tslint:disable-next-line: no-unnecessary-local-variable
74
82
const widgetScriptSource : WidgetScriptSource = { moduleName, scriptUri, source : 'local' } ;
0 commit comments