mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-08 11:48:26 -04:00
Support launching Electron app from shortcut
Former-commit-id: f07d48b6d8f997ea9bbb007ce3a3047c4a153ca4 [formerly 89c34957d030e9708656197b3a754eccbf6a3f11] Former-commit-id: eea94558e0ebd403d41a8d4eab250fedfd5e36ef
This commit is contained in:
parent
5ed6e696b9
commit
889d7c96af
@ -2109,6 +2109,11 @@ define(['jquery', 'zimArchiveLoader', 'uiUtil', 'util', 'utf8', 'images', 'cooki
|
||||
*/
|
||||
function createFakeFileObjectElectron(filename, filepath, callback) {
|
||||
var file = {};
|
||||
// For Electron, we need to set an absolute filepath in case the file was launched from a shortcut (and if it's not already absolute)
|
||||
// DEV: Periodically check Electron hasn't changed its resources folder; NB the ! in indexOf below indicates position at start of string
|
||||
if (!filepath.indexOf(params.archivePath) && /^file:/.test(window.location.protocol)) {
|
||||
filepath = window.location.pathname.replace(/^\//, '').replace(/resources\/app\/www\/[^/]+$/, '') + filepath;
|
||||
}
|
||||
file.name = filename;
|
||||
file.path = filepath;
|
||||
file.readMode = 'electron';
|
||||
|
Loading…
x
Reference in New Issue
Block a user