Perbaiki backup/restore dan script yang tidak jalan dari shortcut

Backup/restore:
- berkas .lazy (format versi 2) kini menyimpan ISI berkas: binary/script dan ikon
  (maks 512 MB per berkas); format versi 1 tetap bisa diimpor
- impor memakai shortcut.Restore: binary ditulis ke ~/.local/bin lokal, ikon dari
  cadangan (atau diunduh ulang dari icon_source), .desktop ditulis dengan path
  lokal, salinan Desktop dibuat sesuai target
- path dari komputer lama tidak dipakai mentah -> tidak ada lagi 'banyak file
  missing'; entri yang tidak bisa dipulihkan ditandai dan bisa dibetulkan via edit
- tes end-to-end: pasang 3 shortcut -> ekspor -> pulihkan di HOME lain -> semua
  berkas lokal, script hasil restore benar-benar jalan

Script:
- script dipasang sebagai wrapper + <slug>.real: wrapper menambahkan
  ~/.local/bin ke PATH dan cd ke folder asli script (desktop environment
  menjalankan dengan cwd = home, PATH sesi)
- .desktop dapat Path= sesuai folder asli script
- opsi 'Run in a terminal window (scripts)' di dialog install & edit
- uninstall membuang wrapper + script aslinya
This commit is contained in:
oxpoe committed 2026-10-13 09:25:49 +07:00
1 parent fdb503e152
commit 581cd07dba
16 files changed
+779 -59

No files matched your search

+19 -13
View File
@@ -36,14 +36,11 @@ func EditExecutable(old store.Shortcut, o ExecOptions) (store.Shortcut, error) {
}
}
// salin kalau sumbernya bukan berkas yang sudah terpasang
if !samePath(src, binDst) {
if err := copyFile(src, binDst, 0o755); err != nil {
return old, err
}
kind := DetectKind(src)
if err := installBinary(kind, src, binDst); err != nil {
return old, err
}
kind := DetectKind(binDst)
execArgs := []string{binDst}
if kind == KindWindows {
wine, err := exec.LookPath("wine")
@@ -73,24 +70,33 @@ func EditExecutable(old store.Shortcut, o ExecOptions) (store.Shortcut, error) {
}
}
entry := Entry{
Name: name,
ExecArgs: execArgs,
Icon: iconPath,
Categories: category,
Terminal: o.Terminal && kind != KindWindows,
NoDisplay: !o.Menu,
}
if kind == KindScript {
if _, err := os.Stat(filepath.Dir(src)); err == nil {
entry.WorkingDir = filepath.Dir(src)
}
}
updated := old
updated.Slug = sl
updated.Name = name
updated.Kind = kind
updated.ExecArgs = execArgs
updated.Categories = category
updated.Terminal = entry.Terminal
updated.BinaryPath = binDst
updated.IconPath = iconPath
updated.IconSource = iconSource
updated.Targets = store.Targets{Menu: o.Menu, Desktop: o.Desktop}
if err := rewriteShortcutFiles(old, &updated, Entry{
Name: name,
ExecArgs: execArgs,
Icon: iconPath,
Categories: category,
NoDisplay: !o.Menu,
}); err != nil {
if err := rewriteShortcutFiles(old, &updated, entry); err != nil {
return old, err
}
return updated, nil