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
@@ -44,7 +44,7 @@ func (ui *app) showExecutableDialog() {
|
||||
browseBin := widget.NewButtonWithIcon(T("browse"), theme.FolderOpenIcon(), func() {
|
||||
pickFile(ui.win, nil, func(path string) {
|
||||
binPath = path
|
||||
binLabel.SetText(filepath.Base(path))
|
||||
binLabel.SetText(filepath.Base(path) + " · " + detectedKind(path))
|
||||
if strings.TrimSpace(nameEntry.Text) == "" {
|
||||
nameEntry.SetText(appNameFromFile(path))
|
||||
}
|
||||
@@ -136,6 +136,15 @@ func pickFile(win fyne.Window, filter storage.FileFilter, onPick func(path strin
|
||||
fd.Show()
|
||||
}
|
||||
|
||||
// detectedKind menampilkan hasil auto-detect jenis berkas di dialog.
|
||||
func detectedKind(path string) string {
|
||||
kind := shortcut.DetectKind(path)
|
||||
if kind == "" {
|
||||
return T("kind_unknown")
|
||||
}
|
||||
return kind
|
||||
}
|
||||
|
||||
func appNameFromFile(path string) string {
|
||||
base := filepath.Base(path)
|
||||
for _, ext := range stripExts {
|
||||
|
||||
Reference in new issue
Block a user