Changed environment variable AVATAR_DIR to LIBRAVATARSERV_DIR to avoid collisions.

AVATAR_DIR is still supported until 1.0.0 for backwards-compatibility.
This commit is contained in:
tastytea 2018-11-27 03:07:12 +01:00
parent 653499be95
commit 13a71f0315
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 11 additions and 12 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.2) cmake_minimum_required (VERSION 3.2)
project(libravatarserv project(libravatarserv
VERSION 0.3.0 VERSION 0.3.1
LANGUAGES CXX LANGUAGES CXX
) )

View File

@ -42,7 +42,7 @@ HTTPS.
libravatarserv looks in each of `${XDG_DATA_DIRS}` for a directory named libravatarserv looks in each of `${XDG_DATA_DIRS}` for a directory named
`libravatarserv`. You can force a different directory by setting the environment `libravatarserv`. You can force a different directory by setting the environment
variable `${AVATAR_DIR}`. variable `${LIBRAVATARSERV_DIR}` (until 0.3.0 `${AVATAR_DIR}`).
The image files are named like your email address, no file extension. If you The image files are named like your email address, no file extension. If you
want to deliver a default image for unknown email addresses, name it `default`. want to deliver a default image for unknown email addresses, name it `default`.

View File

@ -83,17 +83,16 @@ int main()
bool find_avatar_dir() bool find_avatar_dir()
{ {
const char *envdir = std::getenv("AVATAR_DIR"); const char *envdir = std::getenv("LIBRAVATARSERV_DIR");
if (envdir != nullptr) if (envdir == nullptr)
{ {
if (fs::is_directory(envdir)) // TODO: Remove AVATAR_DIR in 1.0.0
{ // DEPRECATED because it is potentially used by another program
avatar_dir = envdir; envdir = std::getenv("AVATAR_DIR");
} }
else if (envdir != nullptr && fs::is_directory(envdir))
{ {
return false; avatar_dir = envdir;
}
} }
else else
{ {