MalloyDelacroix / DownloaderForReddit

The Downloader for Reddit is a GUI application with some advanced features to extract and download submitted content from reddit.
GNU General Public License v3.0
498 stars 47 forks source link

Allow for portable configuration #185

Closed YenForYang closed 3 years ago

YenForYang commented 3 years ago

I'm hoping to make this app compatible with the Scoop package manager for Windows. However, this requires for the app to have a portable config. Possible solutions I'm thinking of:

  1. Add a command-line flag like --data-dir or --config that allows for manually specifying the data directory (overriding get_data_directory).
  2. Check for an environment variable (e.g. REDDIT_DOWNLOADER_CONFIG) that overrides the default data directory
  3. Check for the presence of a Data subdirectory in the application folder (which it looks like get_data_directory falls back to when it can't determine the OS). (Side note: it looks like there may be a typo in the get_data_directory doc-- it says that it uses the Data directory by default on Linux (which it doesn't I believe. I think it uses ~/.SomeGuySoftware/DownloaderForReddit (or I may have misread it)).
  4. Or default to using a Data subdirectory inside the application folder completely instead of checking for an application directory at all. https://github.com/MalloyDelacroix/DownloaderForReddit/blob/943f5cb6ce9f0a7844d9167003f0ad6b81926fba/DownloaderForReddit/utils/system_util.py#L132-L150

Honestly I'm hoping you can do something similar for overriding core.user_save_directory and core.subreddit_save_directory in config.toml, as it would make it much easier for scoop to handle persistent data

MalloyDelacroix commented 3 years ago

In the first versions of the app, the data directory was stored in the application folder. For some reason, this led to a lot of issues with write access being denied to this folder once it was packaged with pyinstaller. The current system was a solution to this problem.

This portability issue has been raised a few times before, but I was unable to find a suitable solution. However, I had not considered being able to set the directory with a command-line flag. I really like this idea.

I will implement this for the next short-term release.

zacker150 commented 3 years ago

For some reason, this led to a lot of issues with write access being denied to this folder once it was packaged with pyinstaller.

This happens because in Windows, programs cannot write to the Program Files folder without Administrator rights.