/** Home folder shown as "~", so screenshots and screen shares do not show the account name. */ export function shortPath(p: string, home: string | null | undefined): string { if (!home) return p; const h = home.replace(/[\\/]+$/, ''); if (p === h) return '~'; return p.startsWith(h + '/') || p.startsWith(h + '\\') ? `~${p.slice(h.length)}` : p; } /** Every occurrence of the home folder in a log text as "~". */ export function tildeText(text: string, home: string | null | undefined): string { const h = home?.replace(/[\\/]+$/, ''); return h && h.length > 1 ? text.split(h).join('~') : text; }