diff --git a/www/js/app.js b/www/js/app.js index c6313ba7..39c63534 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -967,6 +967,9 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'cache', 'images', 'sett if (callback) { callback(null); } else { + // We have failed to load a picked archive via the File System API, but if params.storedFilePath exists, then the archive + // was launched with Electron APIs, so we can get the folder that way + if (params.storedFilePath) params.pickedFolder = params.storedFilePath.replace(/[\\/]+[^\\/]+$/, ''); searchForArchivesInPreferencesOrStorage(); } } diff --git a/www/js/init.js b/www/js/init.js index 04965dd9..777867cf 100644 --- a/www/js/init.js +++ b/www/js/init.js @@ -315,10 +315,10 @@ if (params.storedFile && typeof Windows !== 'undefined' && typeof Windows.Storag } } -if (typeof window.showOpenFilePicker === 'undefined') { +if (!params.pickedFolder && typeof window.showOpenFilePicker === 'undefined') { params.pickedFolder = getSetting('pickedFolder') || ''; - if (!params.pickedFolder) { - params.pickedFile = getSetting('lastSelectedArchivePath') || ''; + if (!params.pickedFolder && !params.pickedFile) { + params.pickedFile = params.storedFilePath || ''; } }