initializeCacheDir function

String initializeCacheDir(
  1. String cacheDir,
  2. String? directory
)

Implementation

String initializeCacheDir(String cacheDir, String? directory) {
  if (cacheDir.startsWith('/')) {
    return cacheDir;
  }

  late String currentDirPath;
  if (directory != null) {
    currentDirPath = Directory(directory).absolute.path;
  } else {
    currentDirPath = Directory.current.absolute.path;
  }

  return join(currentDirPath, cacheDir);
}