Use a 'gallery-dl' subdirectory in ~/.cache to adhere to how other
programs store their cached data, and call os.makedirs() so it also
works without an existing ~/.cache directory.
Use either $XDG_CACHE_HOME or ~/.cache (if the former isn't set)
and store potentially sensitive cookies and tokens in a user's
home directory and not in the world-readable /tmp.
and only on non-Windows systems.
1. On Windows the 'mode' argument for os.open() has no (visible) effect
on access permissions for new files.
2. The default location for 'cache.file' on Windows is in
%USERPROFILE%\AppData\Local\Temp which can only be accessed by the
owner himself (or an admin).
Previously cache.file could be created world readable leading to
possible sensitive information disclosure on multi-user systems.
Restrict permissions only to the owner by creating an empty file.
Please note that cache.file created before this commit may need a
`chmod 600' or similar!
- remove support for old windows config paths
- catch exception if cache-database can't be opened
- fix username/password settings for unit tests
- rename variable 'max_tries' to 'retries'