persepolisdm / persepolis

Persepolis Download Manager is a GUI for aria2.
https://persepolisdm.github.io
GNU General Public License v3.0
6.12k stars 647 forks source link

persepolis uses incorrect temporary directory on macOS #967

Closed sneak closed 2 months ago

sneak commented 2 months ago

System Details:

Persepolis writes temp files to ~/.persepolis/ on macOS. This is incorrect for temp files; the location $TMPDIR should be used instead.

I note also that ~/Library/Application Support/persepolis_download_manager/persepolis_tmp is created; this could also be used but is suboptimal as it may not get correctly cleaned up. Creating directories directly under $HOME is a no-no on macOS; using same for temp files is doubly bad.

alireza-amirsamimi commented 2 months ago

Hello ~/.persepolis is not Temp folder. It contains unfinished download files. The content of this folder is not temporary and should not be deleted or cleand up , ... .

sneak commented 2 months ago

Unfinished downloads are by definition temp files.

If the program is deleted or never launched again, the files should be cleaned up and removed.

alireza-amirsamimi commented 2 months ago

I'm not Mac OSX user. I'm ArchLinux user. In many GNU/LINUX operating systems, temp folders(in /tmp) are deleted after reboot. so I can't assume ~/.persepolis as temporary folder. In GNU/LINUX operating system when an application is uninstalled, the folders in $HOME path and related to that application, should not be deleted or cleaned up because the user may want to reinstall the application.

sneak commented 2 months ago

Then please at least use the platform-specific application directory under ~/Library/Application Support rather than making directories in $HOME.

alireza-amirsamimi commented 2 months ago

You are right. I'll fix this. Thank for reporting this issue.

sneak commented 2 months ago

On macOS it would be appropriate I think to make a ~/Downloads/Persepolis/ and use that for in-flight downloads. Perhaps a ~/Downloads/Persepolis/partial with files moved to ~/Downloads/Persepolis/ when complete.

~/Downloads/ already exists on macOS and is used for this purpose.

I don’t think putting very large files (which partial downloads often are) in ~/Library/Application Support/ is a good idea.

alireza-amirsamimi commented 2 months ago

@sneak I think you are right. putting very large files (which partial downloads often are) in ~/Library/Application Support/ and in ~/.persepolis is not good idea. I must fix this for linux and mac and windows.

alireza-amirsamimi commented 2 months ago

~/Downloads/Persepolis/partial folder is good idea. Thank you

alireza-amirsamimi commented 2 months ago

I fixed this issue. From now on, unfinished downloads will be placed in download folder. Thanks for reporting. :+1: