@@ -327,36 +327,40 @@ function deleteOldFiles(context: ExtensionContext, outputChannel: OutputChannel)
327
327
async function checkAddons ( context : ExtensionContext , odooOutputChannel : OutputChannel ) {
328
328
let files = await workspace . findFiles ( '**/__manifest__.py' )
329
329
let currentConfig = getCurrentConfig ( context )
330
- let missingFiles = files . filter ( file => {
331
- return ! currentConfig . addons . some ( ( addon ) => file . fsPath . startsWith ( addon ) )
332
- } )
333
- let missingPaths = [ ...new Set ( missingFiles . map ( file => {
334
- let filePath = file . fsPath . split ( path . sep )
335
- return filePath . slice ( 0 , filePath . length - 2 ) . join ( path . sep )
336
- } ) ) ]
337
- odooOutputChannel . appendLine ( "Missing addon paths : " + missingPaths . length )
338
- if ( missingPaths . length > 0 ) {
339
- odooOutputChannel . appendLine ( "Missing addon paths : " + JSON . stringify ( missingPaths ) )
340
- const selection = await window . showWarningMessage (
341
- `We detected addon paths that weren't added in the current configuration. Would you like to add them?` ,
342
- "Update current configuration" ,
343
- "View Paths" ,
344
- "Ignore"
345
- ) ;
346
- switch ( selection ) {
347
- case ( "Update current configuration" ) :
348
- ConfigurationWebView . render ( context , currentConfig . id ) ;
349
- break
350
- case ( "View Paths" ) :
351
- odooOutputChannel . show ( ) ;
352
- break
330
+ if ( currentConfig ) {
331
+ let missingFiles = files . filter ( file => {
332
+ return (
333
+ ! currentConfig . addons . some ( ( addon ) => file . fsPath . startsWith ( addon ) ) ||
334
+ ! file . fsPath . startsWith ( currentConfig . odooPath )
335
+ )
336
+ } )
337
+ let missingPaths = [ ...new Set ( missingFiles . map ( file => {
338
+ let filePath = file . fsPath . split ( path . sep )
339
+ return filePath . slice ( 0 , filePath . length - 2 ) . join ( path . sep )
340
+ } ) ) ]
341
+ if ( missingPaths . length > 0 ) {
342
+ odooOutputChannel . appendLine ( "Missing addon paths : " + JSON . stringify ( missingPaths ) )
343
+ const selection = await window . showWarningMessage (
344
+ `We detected addon paths that weren't added in the current configuration. Would you like to add them?` ,
345
+ "Update current configuration" ,
346
+ "View Paths" ,
347
+ "Ignore"
348
+ ) ;
349
+ switch ( selection ) {
350
+ case ( "Update current configuration" ) :
351
+ ConfigurationWebView . render ( context , currentConfig . id ) ;
352
+ break
353
+ case ( "View Paths" ) :
354
+ odooOutputChannel . show ( ) ;
355
+ break
356
+ }
353
357
}
354
358
}
355
359
}
356
360
357
361
async function checkOdooPath ( context : ExtensionContext ) {
358
362
let currentConfig = getCurrentConfig ( context )
359
- let odooFound = workspace . getWorkspaceFolder ( Uri . parse ( currentConfig . odooPath ) )
363
+ let odooFound = currentConfig ? workspace . getWorkspaceFolder ( Uri . parse ( currentConfig . odooPath ) ) : true
360
364
if ( ! odooFound ) {
361
365
let invalidPath = false
362
366
for ( const f of workspace . workspaceFolders ) {
0 commit comments