checkDirectory method

Future<void> checkDirectory(
  1. String root,
  2. String name
)

检查日志文件夹是否存在,如果不存在,则创建文件夹

Implementation

Future<void> checkDirectory(String root, String name) async {
  final file = Directory(root + "/" + name);
  try {
    if (await file.exists()) {
      return;
    }
    await file.create();
    return;
  } catch (e) {
    print("check directory error, error : ${e}");
  }
}