fix(app): open in powershell (#15112)
This commit is contained in:
@@ -118,7 +118,6 @@ const createPlatform = (): Platform => {
|
||||
async openPath(path: string, app?: string) {
|
||||
const os = ostype()
|
||||
if (os === "windows") {
|
||||
const resolvedApp = (app && (await commands.resolveAppPath(app))) || app
|
||||
const resolvedPath = await (async () => {
|
||||
if (window.__OPENCODE__?.wsl) {
|
||||
const converted = await commands.wslPath(path, "windows").catch(() => null)
|
||||
@@ -127,6 +126,16 @@ const createPlatform = (): Platform => {
|
||||
|
||||
return path
|
||||
})()
|
||||
const resolvedApp = (app && (await commands.resolveAppPath(app))) || app
|
||||
const isPowershell = (value?: string) => {
|
||||
if (!value) return false
|
||||
const name = value.toLowerCase().replaceAll("/", "\\").split("\\").pop()
|
||||
return name === "powershell" || name === "powershell.exe"
|
||||
}
|
||||
if (isPowershell(resolvedApp)) {
|
||||
await commands.openInPowershell(resolvedPath)
|
||||
return
|
||||
}
|
||||
return openerOpenPath(resolvedPath, resolvedApp)
|
||||
}
|
||||
return openerOpenPath(path, app)
|
||||
|
||||
Reference in New Issue
Block a user