package cleaner

import (
	"fmt"
	"os"
)

// PurgePath deletes a file or directory permanently
func PurgePath(path string) error {
	// Safety check: Don't delete root or critical paths
	if path == "/" || path == "" {
		return fmt.Errorf("cannot delete root")
	}

	// Check if file exists
	if _, err := os.Stat(path); os.IsNotExist(err) {
		return fmt.Errorf("path does not exist")
	}

	// Perform deletion
	err := os.RemoveAll(path)
	if err != nil {
		return err
	}

	return nil
}
