From 162233fb0b58a27d726c35ff752d5d09bef0d1fc Mon Sep 17 00:00:00 2001 From: Stu Leak Date: Sun, 4 Jan 2026 05:21:11 -0500 Subject: [PATCH] Fix unused imports and restore openFile helper --- main.go | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/main.go b/main.go index 228c0e1..338cca9 100644 --- a/main.go +++ b/main.go @@ -12,12 +12,12 @@ import ( "image/color" "image/png" "io" - "log" "math" "net/url" "os" "os/exec" "path/filepath" + "regexp" "runtime" "slices" "sort" @@ -31,20 +31,16 @@ import ( "fyne.io/fyne/v2/app" "fyne.io/fyne/v2/canvas" "fyne.io/fyne/v2/container" - "fyne.io/fyne/v2/data/binding" "fyne.io/fyne/v2/dialog" "fyne.io/fyne/v2/driver/desktop" "fyne.io/fyne/v2/layout" "fyne.io/fyne/v2/storage" - "fyne.io/fyne/v2/theme" "fyne.io/fyne/v2/widget" "git.leaktechnologies.dev/stu/VideoTools/internal/benchmark" "git.leaktechnologies.dev/stu/VideoTools/internal/convert" - "git.leaktechnologies.dev/stu/VideoTools/internal/enhancement" "git.leaktechnologies.dev/stu/VideoTools/internal/interlace" "git.leaktechnologies.dev/stu/VideoTools/internal/logging" - "git.leaktechnologies.dev/stu/VideoTools/internal/metadata" "git.leaktechnologies.dev/stu/VideoTools/internal/modules" "git.leaktechnologies.dev/stu/VideoTools/internal/player" "git.leaktechnologies.dev/stu/VideoTools/internal/queue" @@ -490,6 +486,23 @@ func openFolder(path string) error { return cmd.Start() } +// openFile tries to open a file in the OS default viewer. +func openFile(path string) error { + if strings.TrimSpace(path) == "" { + return fmt.Errorf("path is empty") + } + var cmd *exec.Cmd + switch runtime.GOOS { + case "windows": + cmd = utils.CreateCommandRaw("explorer", path) + case "darwin": + cmd = utils.CreateCommandRaw("open", path) + default: + cmd = utils.CreateCommandRaw("xdg-open", path) + } + return cmd.Start() +} + func generatePixelatedQRCode() (fyne.CanvasObject, error) { docURL := "https://docs.leaktechnologies.dev/VideoTools"