diff --git a/src/ipc/handlers/shell_handler.ts b/src/ipc/handlers/shell_handler.ts index 22ed507..a543720 100644 --- a/src/ipc/handlers/shell_handler.ts +++ b/src/ipc/handlers/shell_handler.ts @@ -22,4 +22,24 @@ export function registerShellHandlers() { return { success: false, error: (error as Error).message }; } }); + + ipcMain.handle("show-item-in-folder", async (_event, fullPath: string) => { + try { + // Validate that a path was provided + if (!fullPath) { + logger.error("Attempted to show item with empty path"); + return { + success: false, + error: "No file path provided.", + }; + } + + shell.showItemInFolder(fullPath); + logger.debug("Showed item in folder:", fullPath); + return { success: true }; + } catch (error) { + logger.error(`Failed to show item in folder ${fullPath}:`, error); + return { success: false, error: (error as Error).message }; + } + }); } diff --git a/src/ipc/ipc_client.ts b/src/ipc/ipc_client.ts index 71dd2da..37739e4 100644 --- a/src/ipc/ipc_client.ts +++ b/src/ipc/ipc_client.ts @@ -292,8 +292,22 @@ export class IpcClient { return result as { success: boolean; error?: string }; } catch (error) { showError(error); - // Ensure a consistent return type even on invoke error - return { success: false, error: (error as Error).message }; + throw error; + } + } + + public async showItemInFolder( + fullPath: string + ): Promise<{ success: boolean; error?: string }> { + try { + const result = await this.ipcRenderer.invoke( + "show-item-in-folder", + fullPath + ); + return result as { success: boolean; error?: string }; + } catch (error) { + showError(error); + throw error; } } diff --git a/src/pages/app-details.tsx b/src/pages/app-details.tsx index f0f3127..50ea570 100644 --- a/src/pages/app-details.tsx +++ b/src/pages/app-details.tsx @@ -12,6 +12,7 @@ import { MessageCircle, Pencil, Github, + Folder, } from "lucide-react"; import { Popover, @@ -159,6 +160,8 @@ export default function AppDetailsPage() { ); } + const fullAppPath = appBasePath.replace("$APP_BASE_PATH", selectedApp.path); + return (
+
diff --git a/src/preload.ts b/src/preload.ts index 29d5efb..9b22973 100644 --- a/src/preload.ts +++ b/src/preload.ts @@ -30,6 +30,7 @@ const validInvokeChannels = [ "set-user-settings", "get-env-vars", "open-external-url", + "show-item-in-folder", "reset-all", "nodejs-status", "install-node",