Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions app/helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package app

import (
"fmt"
"os/exec"
"runtime"
)

func (a *App) OpenFolder(path string) error {
switch runtime.GOOS {
case "linux":
return exec.Command("xdg-open", path).Start()
case "windows":
return exec.Command("explorer", path).Start()
case "darwin":
return exec.Command("open", path).Start()
default:
return fmt.Errorf("unsupported platform: %s", runtime.GOOS)
}
}
2 changes: 1 addition & 1 deletion frontend/package.json.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a67b50d360aedef1ac0f8ffc81b6bfc5
11bd398870ef96d3bf4e2d7bf28d8e0f
3 changes: 2 additions & 1 deletion frontend/src/sections/project-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
import { useNavigate } from '@tanstack/react-router';
import { useCallback, useMemo } from 'react';
import toast from 'react-hot-toast';
import { OpenFolder } from 'wjs/go/app/App';
import { core } from 'wjs/go/models';
import { BrowserOpenURL } from 'wjs/runtime/runtime';
import { Button } from '~/components/button';
Expand Down Expand Up @@ -209,7 +210,7 @@ export function ProjectInfo({ project }: { project: core.Project }) {
BrowserOpenURL(`http://${projectDomain}`);
}, [projectDomain]);

const openProjectDir = useCallback(() => project.Dir.Valid && BrowserOpenURL(project.Dir.String), [project.Dir]);
const openProjectDir = useCallback(() => project.Dir.Valid && OpenFolder(project.Dir.String), [project.Dir]);

const openUpdateProjectDir = useCallback(
() => updateProjectDir(project.Name, project.Dir.String),
Expand Down
Loading