Problem
Currently, the unpack command silently overwrites existing files/directories if they share the same name as the archived content. This could lead to accidental data loss.
Solution
- Check if the output file/directory exists before writing.
- If it exists, prompt the user:
File 'xyz' already exists. Overwrite? (y/N).
- Add a
--force or -f flag to bypass this check for scripts.
Relevant Code
In main.rs, specifically inside the unpack function where File::create or tar::Archive::unpack is called.