Redesign the desktop workspace with task sidebars, live filters, clearer settings, and an accessible update dialog. Harden encrypted backup imports, configuration persistence, history retention, queue snapshots, shutdown recovery, and update installation ordering. Publish verified Windows artifacts and refreshed English documentation.
30 lines
1.0 KiB
JavaScript
30 lines
1.0 KiB
JavaScript
(function (root) {
|
|
'use strict';
|
|
|
|
function selectOrphanTmps(fileNames, opts) {
|
|
const o = opts || {};
|
|
const baseName = String(o.baseName || '');
|
|
const currentPid = o.currentPid;
|
|
const isAlive = typeof o.isAlive === 'function' ? o.isAlive : () => false;
|
|
const out = [];
|
|
if (!baseName || !Array.isArray(fileNames)) return out;
|
|
const prefix = baseName + '.';
|
|
const suffix = '.tmp';
|
|
for (const file of fileNames) {
|
|
if (typeof file !== 'string') continue;
|
|
if (!file.startsWith(prefix) || !file.endsWith(suffix)) continue;
|
|
const mid = file.slice(prefix.length, file.length - suffix.length);
|
|
if (!/^\d+$/.test(mid)) continue;
|
|
const pid = Number(mid);
|
|
if (pid === currentPid) continue;
|
|
if (isAlive(pid)) continue;
|
|
out.push(file);
|
|
}
|
|
return out;
|
|
}
|
|
|
|
const api = { selectOrphanTmps };
|
|
if (typeof module !== 'undefined' && module.exports) module.exports = api;
|
|
else if (root) root.OrphanTmp = api;
|
|
})(typeof window !== 'undefined' ? window : this);
|