Files
chimera-Public/renderer/modules/game-source-scan.js
T

24 lines
702 B
JavaScript

'use strict';
$('btn-rescan-game-sources').addEventListener('click', async () => {
const btn = $('btn-rescan-game-sources');
btn.disabled = true;
const orig = btn.textContent;
btn.textContent = 'Scanning…';
setStatus('Scanning local game source folders…');
try {
const { total, added } = await window.pork.scanBackups();
await loadGames();
await loadDashboard();
const msg = added > 0
? `Found ${total} game(s) — ${added} new, fetching metadata…`
: `Scan complete: ${total} game(s) found, none new`;
setStatus(msg, 'ok');
} catch (e) {
setStatus(e.message, 'error');
} finally {
btn.disabled = false;
btn.textContent = orig;
}
});