Upload via GUI (39 Dateien)
This commit is contained in:
+28
-5
@@ -90,13 +90,34 @@ let mainWindow = null;
|
|||||||
const hatEinzelSperre = app.requestSingleInstanceLock();
|
const hatEinzelSperre = app.requestSingleInstanceLock();
|
||||||
if (!hatEinzelSperre) app.quit();
|
if (!hatEinzelSperre) app.quit();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Instanz-Kennung aus den Startargumenten lesen.
|
||||||
|
*
|
||||||
|
* Wichtig: Bei einem zweiten Start sortiert Chromium die Argumente um –
|
||||||
|
* alle Schalter wandern nach vorn, alles andere ans Ende. Aus
|
||||||
|
* --launch 1.21.11
|
||||||
|
* wird dabei
|
||||||
|
* --launch --allow-file-access-from-files <pfad> 1.21.11
|
||||||
|
* und die Kennung steht nicht mehr hinter ihrem Schalter. Deshalb wird die
|
||||||
|
* Form "--launch=<kennung>" verwendet: die bleibt ein einziges Argument.
|
||||||
|
*/
|
||||||
function instanzAusArgumenten(argv) {
|
function instanzAusArgumenten(argv) {
|
||||||
const args = argv || [];
|
const args = (argv || []).map(String);
|
||||||
for (let i = 0; i < args.length; i++) {
|
|
||||||
const a = String(args[i]);
|
for (const a of args) {
|
||||||
if (a === '--launch' && args[i + 1]) return String(args[i + 1]);
|
|
||||||
if (a.startsWith('--launch=')) return a.slice('--launch='.length);
|
if (a.startsWith('--launch=')) return a.slice('--launch='.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Notnagel für Verknüpfungen aus früheren Fassungen (und den Aufruf von
|
||||||
|
// Hand): Steht "--launch" allein da, ist die Kennung durch das Umsortieren
|
||||||
|
// ans Ende gerutscht – das letzte Argument, das kein Schalter ist.
|
||||||
|
if (args.includes('--launch')) {
|
||||||
|
const i = args.indexOf('--launch');
|
||||||
|
if (args[i + 1] && !args[i + 1].startsWith('-')) return args[i + 1];
|
||||||
|
for (let j = args.length - 1; j > 0; j--) {
|
||||||
|
if (!args[j].startsWith('-')) return args[j];
|
||||||
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,7 +848,9 @@ ipcMain.handle('instances:shortcut', (_e, id) => {
|
|||||||
const ziel = verknuepfungsZiel();
|
const ziel = verknuepfungsZiel();
|
||||||
const ok = shell.writeShortcutLink(datei, fs.existsSync(datei) ? 'replace' : 'create', {
|
const ok = shell.writeShortcutLink(datei, fs.existsSync(datei) ? 'replace' : 'create', {
|
||||||
target: ziel,
|
target: ziel,
|
||||||
args: `--launch "${id}"`,
|
// Gleichheitsform, damit die Kennung beim Umsortieren durch Chromium
|
||||||
|
// an ihrem Schalter bleibt (siehe instanzAusArgumenten)
|
||||||
|
args: `--launch="${id}"`,
|
||||||
cwd: path.dirname(ziel),
|
cwd: path.dirname(ziel),
|
||||||
description: 'AeroMC – ' + inst.name,
|
description: 'AeroMC – ' + inst.name,
|
||||||
icon: ziel,
|
icon: ziel,
|
||||||
|
|||||||
Reference in New Issue
Block a user