Fix unused imports and restore openFile helper

This commit is contained in:
Stu Leak 2026-01-04 05:21:11 -05:00
parent 8441500c61
commit 162233fb0b

23
main.go
View File

@ -12,12 +12,12 @@ import (
"image/color" "image/color"
"image/png" "image/png"
"io" "io"
"log"
"math" "math"
"net/url" "net/url"
"os" "os"
"os/exec" "os/exec"
"path/filepath" "path/filepath"
"regexp"
"runtime" "runtime"
"slices" "slices"
"sort" "sort"
@ -31,20 +31,16 @@ import (
"fyne.io/fyne/v2/app" "fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/canvas" "fyne.io/fyne/v2/canvas"
"fyne.io/fyne/v2/container" "fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/data/binding"
"fyne.io/fyne/v2/dialog" "fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/driver/desktop" "fyne.io/fyne/v2/driver/desktop"
"fyne.io/fyne/v2/layout" "fyne.io/fyne/v2/layout"
"fyne.io/fyne/v2/storage" "fyne.io/fyne/v2/storage"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget" "fyne.io/fyne/v2/widget"
"git.leaktechnologies.dev/stu/VideoTools/internal/benchmark" "git.leaktechnologies.dev/stu/VideoTools/internal/benchmark"
"git.leaktechnologies.dev/stu/VideoTools/internal/convert" "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/interlace"
"git.leaktechnologies.dev/stu/VideoTools/internal/logging" "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/modules"
"git.leaktechnologies.dev/stu/VideoTools/internal/player" "git.leaktechnologies.dev/stu/VideoTools/internal/player"
"git.leaktechnologies.dev/stu/VideoTools/internal/queue" "git.leaktechnologies.dev/stu/VideoTools/internal/queue"
@ -490,6 +486,23 @@ func openFolder(path string) error {
return cmd.Start() 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) { func generatePixelatedQRCode() (fyne.CanvasObject, error) {
docURL := "https://docs.leaktechnologies.dev/VideoTools" docURL := "https://docs.leaktechnologies.dev/VideoTools"