impellercCacheDirectory function

Directory impellercCacheDirectory()

Where downloaded compilers are kept, per user.

Implementation

Directory impellercCacheDirectory() {
  final environment = Platform.environment;
  final base = Platform.isWindows
      ? (environment['LOCALAPPDATA'] ?? environment['APPDATA'])
      : (environment['XDG_CACHE_HOME'] ??
            (environment['HOME'] == null
                ? null
                : '${environment['HOME']}/.cache'));
  if (base == null) {
    throw Exception(
      'Cannot place the impellerc cache: no home directory is set.',
    );
  }
  return Directory('$base/flutter_gpu_shaders/impellerc');
}