Fix electron loading of split ZIM archives

Former-commit-id: 3a314aeb3978348dd5ee938dc08e01a7d5b87ef4 [formerly 4c9a9260fe3c40dcf821984f459803da07f858f3] [formerly ca042ed05768e0f4b6852a96d21ab5894155d211] [formerly 012315de4dedf71c09a525b2ef6c9a710f95520a [formerly 9cf4b45567ed20aedc1e278ad91e493b9604c539 [formerly b13fd663af83e6938c82c431afa3c1549fd7964e]]]
Former-commit-id: 82f409246b36b4a22b5e872d583d363423bf5903 [formerly 45bde110fda2a7f02cf828f03c99618bf710aaba [formerly 3c8f657dcacbb49bbb175004659fdfc2943fb3ae]]
Former-commit-id: 26f762ac49c1da1571f8adae9aff9fbaaa9e7716 [formerly 251d8f0039c4008cef99de83657fa2b078102432]
Former-commit-id: 373e8c8ed5de5b686f6d4556a4113ac471a79e2f
This commit is contained in:
Jaifroid 2022-03-10 07:23:04 +00:00
parent dec79716d5
commit ee11860a93
2 changed files with 6 additions and 3 deletions

View File

@ -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();
}
}

View File

@ -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 || '';
}
}