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
@@ -46,10 +46,12 @@ func checkRunnable(path string) error {
|
||||
head := make([]byte, 4)
|
||||
n, _ := io.ReadFull(f, head)
|
||||
head = head[:n]
|
||||
if bytes.HasPrefix(head, []byte{0x7f, 'E', 'L', 'F'}) || bytes.HasPrefix(head, []byte("#!")) {
|
||||
if bytes.HasPrefix(head, []byte{0x7f, 'E', 'L', 'F'}) ||
|
||||
bytes.HasPrefix(head, []byte("#!")) ||
|
||||
bytes.HasPrefix(head, []byte("MZ")) { // .exe Windows (dijalankan lewat wine)
|
||||
return nil
|
||||
}
|
||||
return errors.New("not an executable binary (ELF, AppImage, or script only)")
|
||||
return errors.New("not an executable (ELF, AppImage, script, or Windows .exe)")
|
||||
}
|
||||
|
||||
// copyFile menyalin src ke dst lewat file sementara supaya dst tidak pernah setengah tertulis.
|
||||
|
||||
Reference in new issue
Block a user