Files
orca/src/main/terminal-history-paths.ts
T
mirror 34fa2cd5ca
Skill update round trip / roundtrip (false, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, ubuntu-latest, symlink, latest) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (false, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, macos-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, ubuntu-latest, symlink, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, copy, 1.5.17) (push) Canceled after 0s
Skill update round trip / roundtrip (true, windows-latest, symlink, 1.5.17) (push) Canceled after 0s
source snapshot 2026-09-02
2026-09-02 02:03:16 +08:00

32 lines
1.1 KiB
TypeScript

import { existsSync, readdirSync } from 'node:fs'
import { join } from 'node:path'
import { getAppEnvironment } from '../shared/app-environment'
const HISTORY_DIR_NAME = 'terminal-history'
const HISTORY_DIR_NAME_WSL = 'terminal-history-wsl'
// Why: rename live history out of the way first so a quit mid-rm still leaves a durable tombstone GC can finish.
export const PENDING_DELETE_DIR_NAME = '.pending-delete'
export { hashWorktreeId } from './terminal-history-id'
export function getHistoryRoot(): string {
return join(getAppEnvironment().getPath('userData'), HISTORY_DIR_NAME)
}
export function getHistoryRootWsl(distro: string): string {
return join(getAppEnvironment().getPath('userData'), HISTORY_DIR_NAME_WSL, distro)
}
/** Every per-distro WSL history root that exists on disk; empty when WSL history was never written. */
export function listWslHistoryRoots(): string[] {
const wslRoot = join(getAppEnvironment().getPath('userData'), HISTORY_DIR_NAME_WSL)
if (!existsSync(wslRoot)) {
return []
}
try {
return readdirSync(wslRoot).map((distro) => join(wslRoot, distro))
} catch {
return []
}
}