@@ -219,11 +219,13 @@ async function getArchiveEntry(window, archiveEntryType, options) {
219
219
} ;
220
220
}
221
221
222
+ let promise ;
222
223
if ( options . showChooser ) {
223
- return _getArchiveEntryShowChooser ( window , archiveEntryType , options ) ;
224
+ promise = _getArchiveEntryShowChooser ( window , archiveEntryType , options ) ;
224
225
} else {
225
- return _getArchiveEntry ( archiveEntryType , options ) ;
226
+ promise = _getArchiveEntry ( archiveEntryType , options ) ;
226
227
}
228
+ return promise ;
227
229
}
228
230
229
231
@@ -253,6 +255,11 @@ async function _addDirectoryPaths(directory, paths, pathPrefix) {
253
255
async function _getArchiveEntryShowChooser ( targetWindow , archiveEntryTypeName , archiveEntryTypeOptions ) {
254
256
// lazy load to allow initialization
255
257
const i18n = require ( './i18next.config' ) ;
258
+ const { getLogger } = require ( './wktLogging' ) ;
259
+ const wktLogger = getLogger ( ) ;
260
+
261
+ wktLogger . debug ( 'entering _getArchiveEntryShowChooser(%s, %s, %s)' ,
262
+ targetWindow , archiveEntryTypeName , JSON . stringify ( archiveEntryTypeOptions ) ) ;
256
263
257
264
const result = { } ;
258
265
const archiveEntryType = getEntryTypes ( ) [ archiveEntryTypeName ] ;
@@ -287,15 +294,20 @@ async function _getArchiveEntryShowChooser(targetWindow, archiveEntryTypeName, a
287
294
result . archiveUpdatePath = result . archivePath ;
288
295
if ( chooserType === 'openDirectory' ) {
289
296
result . archiveUpdatePath = `${ result . archivePath } /` ;
290
- result . childPaths = _getDirectoryPaths ( result . filePath ) ;
297
+ result . childPaths = await _getDirectoryPaths ( result . filePath ) ;
291
298
}
292
299
}
300
+ wktLogger . debug ( 'exiting _getArchiveEntryShowChooser() with %s' , JSON . stringify ( result ) ) ;
293
301
return result ;
294
302
}
295
303
296
304
async function _getArchiveEntry ( archiveEntryTypeName , archiveEntryTypeOptions ) {
297
305
// lazy load to allow initialization
298
306
const i18n = require ( './i18next.config' ) ;
307
+ const { getLogger } = require ( './wktLogging' ) ;
308
+ const wktLogger = getLogger ( ) ;
309
+
310
+ wktLogger . debug ( 'entering _getArchiveEntry(%s, %s)' , archiveEntryTypeName , JSON . stringify ( archiveEntryTypeOptions ) ) ;
299
311
300
312
const result = { } ;
301
313
const archiveEntryTypes = getEntryTypes ( ) ;
@@ -334,8 +346,9 @@ async function _getArchiveEntry(archiveEntryTypeName, archiveEntryTypeOptions) {
334
346
result . archiveUpdatePath = result . archivePath ;
335
347
if ( archiveEntryTypes [ result . archiveEntryType ] . subtype !== 'file' ) {
336
348
result . archiveUpdatePath = `${ result . archivePath } /` ;
337
- result . childPaths = _getDirectoryPaths ( result . filePath ) ;
349
+ result . childPaths = await _getDirectoryPaths ( result . filePath ) ;
338
350
}
351
+ wktLogger . debug ( 'exiting _getArchiveEntryShowChooser() with %s' , JSON . stringify ( result ) ) ;
339
352
return result ;
340
353
}
341
354
0 commit comments