@@ -2,7 +2,7 @@ import { ipcMain, BrowserWindow, shell } from 'electron';
22import * as fs from 'fs/promises' ;
33import * as path from 'path' ;
44import * as os from 'os' ;
5- import { exec } from 'child_process' ;
5+
66import {
77 getKeyList ,
88 getCurrentKey ,
@@ -365,15 +365,24 @@ Droid instructions here.
365365 await shell . openPath ( filePath ) ;
366366 } ) ;
367367
368- // dk CLI check
368+ // dk CLI check - Windows: Get-Command, macOS/Linux: check file directly (GUI apps don't inherit terminal PATH)
369369 ipcMain . handle ( 'dk:check' , async ( ) : Promise < { installed : boolean ; installCmd : string ; platform : string } > => {
370370 const platform = os . platform ( ) ;
371- const cmd = platform === 'win32'
372- ? 'powershell -NoProfile -Command "if (Get-Command dk -ErrorAction SilentlyContinue) { exit 0 } else { exit 1 }"'
373- : 'which dk' ;
374- const installed = await new Promise < boolean > ( ( resolve ) => {
375- exec ( cmd , ( error ) => resolve ( ! error ) ) ;
376- } ) ;
371+ let installed = false ;
372+ if ( platform === 'win32' ) {
373+ const { exec } = await import ( 'child_process' ) ;
374+ installed = await new Promise < boolean > ( ( resolve ) => {
375+ exec ( 'powershell -NoProfile -Command "if (Get-Command dk -ErrorAction SilentlyContinue) { exit 0 } else { exit 1 }"' ,
376+ ( error ) => resolve ( ! error ) ) ;
377+ } ) ;
378+ } else {
379+ try {
380+ await fs . access ( path . join ( os . homedir ( ) , '.local' , 'bin' , 'dk' ) ) ;
381+ installed = true ;
382+ } catch {
383+ // file not found
384+ }
385+ }
377386 const installCmd = platform === 'win32'
378387 ? 'irm https://raw.githubusercontent.com/notdp/oroio/main/install.ps1 | iex'
379388 : 'curl -fsSL https://raw.githubusercontent.com/notdp/oroio/main/install.sh | bash' ;
0 commit comments