fix(tasks): use path.isAbsolute() for cross-platform path detection
Fixes Cubic AI review finding: startsWith('/') doesn't work on Windows
where absolute paths use drive letters (e.g., C:\).
This commit is contained in:
parent
1712907057
commit
8e349aad7e
@ -1,4 +1,4 @@
|
|||||||
import { join, dirname, basename } from "path"
|
import { join, dirname, basename, isAbsolute } from "path"
|
||||||
import { existsSync, mkdirSync, readFileSync, writeFileSync, renameSync, unlinkSync, readdirSync } from "fs"
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, renameSync, unlinkSync, readdirSync } from "fs"
|
||||||
import { randomUUID } from "crypto"
|
import { randomUUID } from "crypto"
|
||||||
import { getOpenCodeConfigDir } from "../../shared/opencode-config-dir"
|
import { getOpenCodeConfigDir } from "../../shared/opencode-config-dir"
|
||||||
@ -10,7 +10,7 @@ export function getTaskDir(config: Partial<OhMyOpenCodeConfig> = {}): string {
|
|||||||
const storagePath = tasksConfig?.storage_path
|
const storagePath = tasksConfig?.storage_path
|
||||||
|
|
||||||
if (storagePath) {
|
if (storagePath) {
|
||||||
return storagePath.startsWith("/") ? storagePath : join(process.cwd(), storagePath)
|
return isAbsolute(storagePath) ? storagePath : join(process.cwd(), storagePath)
|
||||||
}
|
}
|
||||||
|
|
||||||
const configDir = getOpenCodeConfigDir({ binary: "opencode" })
|
const configDir = getOpenCodeConfigDir({ binary: "opencode" })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user