X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=tfortune.c;h=e3eef042fcd2b81bd4bb24a96243d28c5f66ed94;hb=1c92dba620eba8f40a18e231cfae186e96793cc1;hp=02e54ea40e864032e75886c454bb742b8b3c37c8;hpb=0c39a7e8f0393d0c97cbecca10590afce51abb8f;p=tfortune.git diff --git a/tfortune.c b/tfortune.c index 02e54ea..e3eef04 100644 --- a/tfortune.c +++ b/tfortune.c @@ -302,9 +302,16 @@ static char *get_basedir(void) static char *get_epidir(void) { char *basedir, *epidir; + struct stat s; + basedir = get_basedir(); xasprintf(&epidir, "%s/epigrams", basedir); free(basedir); + if (!OPT_GIVEN(TFORTUNE, BASEDIR) && stat(epidir, &s) < 0) { + free(epidir); + epidir = xstrdup(DATADIR "/tfortunes/epigrams"); + INFO_LOG("falling back to system-wide epidir %s\n", epidir); + } return epidir; }