File size: 821 Bytes
09aec41 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /** Browser-local shell preference; Host discovery decides whether the saved path is usable. */
const KEY = 'dsh.terminal.shell'
/**
* Read the browser preference.
* @returns the last selected shell path, or null when storage is unavailable.
*/
export function preferredShell(): string | null {
try { return typeof localStorage === 'undefined' ? null : localStorage.getItem(KEY) }
catch (_storageUnavailable) { return null }
}
/**
* Remember the selected shell without making storage a startup dependency.
* @param path - verified executable path offered by the Host.
*/
export function rememberShell(path: string): void {
try { if (typeof localStorage !== 'undefined') localStorage.setItem(KEY, path) }
catch (_storageUnavailable) { /* Private browsing or quota failure leaves this launch usable. */ }
}
|