Currently the cache will always live in the home directory. This
allows the user to specify a directory to store the cache in with the
TLDR_CACHE_DIR environment variable. If the environment variable is
not set, the default will still be the home directory.
Why the change?
Requested by #37
Also it's been too long since I got to write any C
How can this be tested?
Compile the app with this patch
Run TLDR_CACHE_DIR=/some/path tldr man and note that /some/path/.tldrc is populated with cache data
Run tldr man without the TLDR_CACHE_DIR variable and note that ~/.tldrc is populated with cache data
Where to start code review?
The gethome() function in utils.c
Relevant tickets?
37
Questions?
Right now setting TLDR_CACHE_DIR to /some/path will result in populating a directory /some/path/.tldrc. Should this instead just put the cache data directly in /some/path and skip the "extra" directory?
Also is it worth computing the result of gethome() only once and caching it? I don't know if calls to getenv() are expensive.
What does it do?
Currently the cache will always live in the home directory. This allows the user to specify a directory to store the cache in with the
TLDR_CACHE_DIR
environment variable. If the environment variable is not set, the default will still be the home directory.Why the change?
Requested by #37
Also it's been too long since I got to write any C
How can this be tested?
TLDR_CACHE_DIR=/some/path tldr man
and note that/some/path/.tldrc
is populated with cache datatldr man
without theTLDR_CACHE_DIR
variable and note that~/.tldrc
is populated with cache dataWhere to start code review?
The
gethome()
function in utils.cRelevant tickets?
37
Questions?
Right now setting
TLDR_CACHE_DIR
to/some/path
will result in populating a directory/some/path/.tldrc
. Should this instead just put the cache data directly in/some/path
and skip the "extra" directory?Also is it worth computing the result of
gethome()
only once and caching it? I don't know if calls togetenv()
are expensive.