prepareFallbackJidoujishoDirectory method

Future<Directory> prepareFallbackJidoujishoDirectory()

Return the app external directory found in the internal app directory. This path also initialises the folder if it does not exist, and includes a .nomedia file within the folder.

Implementation

Future<Directory> prepareFallbackJidoujishoDirectory() async {
  String directoryPath = path.join(appDirectory.path, 'jidoujishoExport');
  String noMediaFilePath =
      path.join(appDirectory.path, 'jidoujishoExport', '.nomedia');

  Directory jidoujishoDirectory = Directory(directoryPath);
  File noMediaFile = File(noMediaFilePath);

  if (!jidoujishoDirectory.existsSync()) {
    jidoujishoDirectory.createSync(recursive: true);
  }
  if (!noMediaFile.existsSync()) {
    noMediaFile.createSync();
  }

  return jidoujishoDirectory;
}