Thanks Aditya.

What do you think of changing the default luatex-cache directory to the system's temporary directory? Consider:
  • The $HOME directory is sacrosanct (4784 people agree: https://bugs.launchpad.net/ubuntu/+source/snapd/+bug/1575053)
  • The temp directory is cleared on Linux (Unix?) system reboots; purged during regular Windows upkeep
  • The temp directory is writable by default
  • Changing the location requires calling an additional program, which isn't obvious (principle of least astonishment)
My text editor invokes ConTeXt like:

    if( TYPESETTER.canRun() ) {
      env.put( "TEXMFCACHE", System.getProperty( "java.io.tmpdir" ) );

      mArgs.add( TYPESETTER.getName() );
      mArgs.add( .. --path .. --purge .. --batch .. --result .. --environment .. etc. );
      mArgs.add( inputFilename );
    }

The first line ensures that "context" is an executable located in a PATH directory. The second line attempts to change the luatex-cache directory. The remaining lines configure the command-line arguments prior to running ConTeXt.

Fearing flaming wrath from users, an additional mtxrun call is required, which incurs overhead:
  • Check for mtxrun executable
  • Run mtxrun each time
This would work but feels like a leaky abstraction (i.e., the context executable should honour TEXMFCACHE without needing to invoke mtxrun because context creates the luatex-cache directory).

Thoughts?