feat: merge F8/x delete with F11 archive extraction

- Delete mode toggle ('d') inside existing confirm dialog instead of separate modal
- F11/e shows confirm dialog before extracting archive to opposite pane
- deleteKind field toggles between 'permanent' and 'trash'
- Active pane reloads after extraction so files appear immediately
This commit is contained in:
vrubelroman 2026-04-29 13:42:59 +03:00
parent 8589187a10
commit 3229d9b263
3 changed files with 204 additions and 114 deletions

View file

@ -44,6 +44,23 @@ func ExtractArchiveToTemp(sourcePath string) (string, error) {
return tempDir, nil
}
// ExtractArchiveToDir extracts an archive to the specified target directory.
// Unlike ExtractArchiveToTemp, it extracts directly to targetDir without
// creating a temporary directory.
func ExtractArchiveToDir(sourcePath, targetDir string) error {
sourceLower := strings.ToLower(sourcePath)
switch {
case strings.HasSuffix(sourceLower, ".zip"):
return extractZipArchive(sourcePath, targetDir)
case strings.HasSuffix(sourceLower, ".tar"):
return extractTarArchive(sourcePath, targetDir, false)
case strings.HasSuffix(sourceLower, ".tar.gz"), strings.HasSuffix(sourceLower, ".tgz"):
return extractTarArchive(sourcePath, targetDir, true)
default:
return fmt.Errorf("archive format is not supported: %s", filepath.Ext(sourcePath))
}
}
func extractZipArchive(sourcePath string, targetDir string) error {
reader, err := zip.OpenReader(sourcePath)
if err != nil {