Avoid copying extracted files to/from temporary (cache) folders when possible
Steps to reproduce:
- Have a large compressed file ("file.lzo") on a separate disk (e.g. a removable disk)
- Open the file using file-roller
- Extract "file" to a local folder (same filesystem as ~/.cache)
What happens:
- File-roller copies (!) the compressed file to the local disk, to
~/.cache/fr-[random]/file.lzo
- File-roller extracts the compressed file to the same (!) folder (
~/.cache/fr-[random]/file
- File-roller copies (!) the uncompressed file to the target folder on the same file system
What should happen:
- No need to copy the source file at all. This is just wasting resources.
- File-roller may want to extract the file to the target dir directly (why not?)
- If you really need to do any copy operation on the local filesystem, you can just use
mv
org_file_move
which will use native operations (simply creating a new and deleting the old hardlink) where possible.
If you really need to do two of these operations, please do not write the intermediate file to the filesystem. You can use the concept of pipes instead. For example, to extract a .tar.lzo file, you may start two processes. The first one reads the archive and decompresses it into a pipe. The second process will untar it and write it to disk.
Edited by Christian Stadelmann