Label jenis aplikasi dengan auto-detect (Go/AppImage/Electron/Script/Windows/Binary/PWA)
- internal/shortcut/kind.go: deteksi dari isi berkas - build info Go, magic AppImage, resources/*.asar untuk Electron, shebang untuk script, MZ untuk .exe - .exe Windows kini boleh dipasang dan dijalankan lewat wine (Exec=wine <path>); kalau wine tidak terpasang, install ditolak dengan pesan jelas - metadata menyimpan kind; chip jenis ditampilkan di setiap baris shortcut (data lama tetap tampil sebagai Executable/PWA) - dialog menampilkan hasil deteksi setelah berkas dipilih, mis. 'winbox.exe - windows' - README: bagian label otomatis + screenshot baru
This commit is contained in:
1 parent
41ada9a506
commit
d6f6c69c5a
13 files changed
+249
-13
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"os"
|
||||
"os/exec"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -65,9 +66,20 @@ func InstallExecutable(o ExecOptions) (store.Shortcut, error) {
|
||||
return sc, err
|
||||
}
|
||||
|
||||
// jenis aplikasi dideteksi otomatis; .exe Windows dijalankan lewat wine
|
||||
kind := DetectKind(o.BinaryPath)
|
||||
execArgs := []string{binDst}
|
||||
if kind == KindWindows {
|
||||
wine, err := exec.LookPath("wine")
|
||||
if err != nil {
|
||||
return sc, errors.New("this is a Windows .exe; install wine first so the shortcut can run it")
|
||||
}
|
||||
execArgs = []string{wine, binDst}
|
||||
}
|
||||
|
||||
entry := Entry{
|
||||
Name: name,
|
||||
ExecArgs: []string{binDst},
|
||||
ExecArgs: execArgs,
|
||||
Icon: iconPath,
|
||||
Categories: category(o.Category, "Utility;"),
|
||||
NoDisplay: !o.Menu,
|
||||
@@ -80,6 +92,7 @@ func InstallExecutable(o ExecOptions) (store.Shortcut, error) {
|
||||
Slug: sl,
|
||||
Name: name,
|
||||
Type: store.TypeExecutable,
|
||||
Kind: kind,
|
||||
ExecArgs: entry.ExecArgs,
|
||||
BinaryPath: binDst,
|
||||
IconPath: iconPath,
|
||||
@@ -174,6 +187,7 @@ func InstallWebApp(o WebOptions) (store.Shortcut, error) {
|
||||
Slug: sl,
|
||||
Name: name,
|
||||
Type: store.TypeWebApp,
|
||||
Kind: KindPWA,
|
||||
URL: pageURL,
|
||||
Browser: strings.Join(o.Browser.Exec, " "),
|
||||
ExecArgs: entry.ExecArgs,
|
||||
|
||||
Reference in new issue
Block a user