fix(warp): probe Warp's Linux paths only on Linux

Every non-macOS, non-Windows platform fell through to the Linux locations.
Candidates are now exact per platform: macOS bundles, Linux state dirs,
Windows LOCALAPPDATA, and none elsewhere.
This commit is contained in:
Resham Joshi 2026-11-06 05:49:31 -08:00
parent 9032195029
commit 7e67d64c73
3 changed files with 5 additions and 3 deletions

View file

@ -134,11 +134,12 @@ export function getDbCandidates(dbPathOverride?: string, platform: string = proc
const localAppData = process.env['LOCALAPPDATA'] || join(homedir(), 'AppData', 'Local')
return [join(localAppData, 'warp', 'Warp', 'data', 'warp.sqlite')]
}
if (platform !== 'darwin') {
if (platform === 'linux') {
const stateHome = process.env['XDG_STATE_HOME'] || join(homedir(), '.local', 'state')
return [join(stateHome, 'warp-terminal', 'warp.sqlite'), join(stateHome, 'warp-terminal-preview', 'warp.sqlite')]
}
return [warpDbPath(WARP_STABLE_BUNDLE_ID), warpDbPath(WARP_PREVIEW_BUNDLE_ID)]
if (platform === 'darwin') return [warpDbPath(WARP_STABLE_BUNDLE_ID), warpDbPath(WARP_PREVIEW_BUNDLE_ID)]
return []
}
function normalizeModel(rawModel: string): string {

View file

@ -62,7 +62,7 @@ describe('probeRoots mirrors discovery resolution', () => {
])
const defaults = await createWarpProvider().probeRoots!()
expect(defaults.map(root => root.path)).toEqual(getDbCandidates())
expect(defaults).toHaveLength(process.platform === 'win32' ? 1 : 2)
expect(defaults).toHaveLength(process.platform === 'win32' ? 1 : process.platform === 'darwin' || process.platform === 'linux' ? 2 : 0)
for (const root of defaults) {
expect(isAbsolute(root.path)).toBe(true)
expect(root.label).toBe('db')

View file

@ -524,5 +524,6 @@ describe('warp db locations', () => {
join('C:\\Users\\me\\AppData\\Local', 'warp', 'Warp', 'data', 'warp.sqlite'),
])
expect(getDbCandidates(undefined, 'darwin')[0]).toContain('Group Containers')
expect(getDbCandidates(undefined, 'freebsd')).toEqual([])
})
})