35 lines
1.3 KiB
Dart
35 lines
1.3 KiB
Dart
import 'dart:io';
|
|
|
|
import 'copy_center.dart' as copy show diskSpace;
|
|
import 'volumes.dart';
|
|
|
|
/// 약속: 파일 탐색기가 기기에서 받는 것 - 저장 장치 목록 · 드라이브를 열 수 있는지 (화면을 멈추지 않는 비동기) ·
|
|
/// 저장 장치의 남은 공간 · 전체 (E6 Total Commander 모양, 못 재면 null) · Android 에서만 하는 것 (경로 입력의 SMB 안내 · SMB 서버 메뉴, 앱 휴지통, .nomedia 메뉴).
|
|
/// 앱은 [RealExplorerDevice] (이 기기 그대로) 를 쓰고, 시험은 시험 폴더를 저장 장치로 주는 구현을 넘긴다
|
|
abstract interface class ExplorerDevice {
|
|
Future<List<(String, String)>> listVolumes();
|
|
Future<bool> probeDrive(String path);
|
|
Future<(int, int)?> diskSpace(String path);
|
|
bool get androidPaths;
|
|
bool get androidTrash;
|
|
bool get nomedia;
|
|
}
|
|
|
|
/// 이 기기 그대로
|
|
class RealExplorerDevice implements ExplorerDevice {
|
|
const RealExplorerDevice();
|
|
|
|
@override
|
|
Future<List<(String, String)>> listVolumes() => localVolumes();
|
|
@override
|
|
Future<bool> probeDrive(String path) => Directory(path).exists();
|
|
@override
|
|
Future<(int, int)?> diskSpace(String path) => copy.diskSpace(path);
|
|
@override
|
|
bool get androidPaths => Platform.isAndroid;
|
|
@override
|
|
bool get androidTrash => Platform.isAndroid;
|
|
@override
|
|
bool get nomedia => Platform.isAndroid;
|
|
}
|