move 기능 추가

This commit is contained in:
toki 2023-02-19 07:30:12 +09:00
parent 49c66d8c9d
commit 560e0535e1

View file

@ -44,7 +44,8 @@ class Path {
static Future<bool> copy(String startPath, String destPath, bool isDir,
{required List<String>? ignorePattern,
required List<String>? ignoredList}) async {
required List<String>? ignoredList,
bool isMove = false}) async {
var c = Completer<bool>();
var result = true;
if (ignorePattern != null) {
@ -78,7 +79,11 @@ class Path {
var destDir = Directory(destPath);
if (!destDir.existsSync()) destDir.createSync(recursive: true);
print('File copy: $startPath --> $destChildPath');
await File(startPath).copy(destChildPath);
var file = File(startPath);
await file.copy(destChildPath);
if (isMove) {
file.delete(recursive: true);
}
}
} on Exception catch (e) {
result = false;