In the case of root install it is useful to be able to allow write
access only to cache directory. By keeping the lock inside the
directory we avoid needing write access to that parent directory.
See: #535
Since the sanity file is used to determine if the cache
is valid it makes sense that it lives in the cache. Without this
user who switch cache by setting EM_CACHE will not invalidate their
sanity file.
Fixes: #11597
The cache is something that can't really be shared between emscripten
versions. In fact having a single location for the cache means
that developers with more then one version of emscripten often have
their cache cleared whenever they switch version.
With this method the cache it always local the to emscripten directory.
If distro what to install emscripten in a read-only or shared location
then can still use the CACHE config file setting, or set EM_CACHE
in the environment.
This is part of a wider push to stop using $HOME where we can and
move towards an embedded mode where it makes sense.
See: #9543
emsdk has always had partial support for this. With this change all
emscripten users can take advantage of embedded config. This allows
different emscripten installations to have different configuration files
since they don't need to share a single config file in the user's home
directory.
As a followup and plan to make this location the default when generating
a new sample config file.
See #9543