File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package app
2+
3+ import (
4+ "fmt"
5+ "os/exec"
6+ "runtime"
7+ )
8+
9+ func (a * App ) OpenFolder (path string ) error {
10+ switch runtime .GOOS {
11+ case "linux" :
12+ return exec .Command ("xdg-open" , path ).Start ()
13+ case "windows" :
14+ return exec .Command ("explorer" , path ).Start ()
15+ case "darwin" :
16+ return exec .Command ("open" , path ).Start ()
17+ default :
18+ return fmt .Errorf ("unsupported platform: %s" , runtime .GOOS )
19+ }
20+ }
Original file line number Diff line number Diff line change 1- a67b50d360aedef1ac0f8ffc81b6bfc5
1+ 11bd398870ef96d3bf4e2d7bf28d8e0f
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import {
1010import { useNavigate } from '@tanstack/react-router' ;
1111import { useCallback , useMemo } from 'react' ;
1212import toast from 'react-hot-toast' ;
13+ import { OpenFolder } from 'wjs/go/app/App' ;
1314import { core } from 'wjs/go/models' ;
1415import { BrowserOpenURL } from 'wjs/runtime/runtime' ;
1516import { Button } from '~/components/button' ;
@@ -209,7 +210,7 @@ export function ProjectInfo({ project }: { project: core.Project }) {
209210 BrowserOpenURL ( `http://${ projectDomain } ` ) ;
210211 } , [ projectDomain ] ) ;
211212
212- const openProjectDir = useCallback ( ( ) => project . Dir . Valid && BrowserOpenURL ( project . Dir . String ) , [ project . Dir ] ) ;
213+ const openProjectDir = useCallback ( ( ) => project . Dir . Valid && OpenFolder ( project . Dir . String ) , [ project . Dir ] ) ;
213214
214215 const openUpdateProjectDir = useCallback (
215216 ( ) => updateProjectDir ( project . Name , project . Dir . String ) ,
You can’t perform that action at this time.
0 commit comments