- opt: android default dir move to external storage
- fix: err when font not exist
This commit is contained in:
lollipopkit
2023-03-27 13:56:17 +08:00
parent 9e3afe98a9
commit 2747df64dd
4 changed files with 22 additions and 11 deletions

View File

@@ -1,8 +1,18 @@
import 'dart:io';
import 'package:path_provider/path_provider.dart';
import 'package:toolbox/core/utils/platform.dart';
Future<Directory> get docDir async => await getApplicationDocumentsDirectory();
Future<Directory> get docDir async {
if (isAndroid) {
final dir = await getExternalStorageDirectory();
if (dir != null) {
return Directory('${dir.path}/server_box');
}
// fallthrough to getApplicationDocumentsDirectory
}
return await getApplicationDocumentsDirectory();
}
Future<Directory> get sftpDownloadDir async {
final dir = Directory('${(await docDir).path}/sftp');