Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

[packages] remove unused createDirectory and exists from dir_utils

Prateek Sunalc7d189e602fa
diff --git a/mobile/packages/dir_utils/lib/dir_utils.dart b/mobile/packages/dir_utils/lib/dir_utils.dart
index 4be31b3538..7b51093fb0 100644
--- a/mobile/packages/dir_utils/lib/dir_utils.dart
+++ b/mobile/packages/dir_utils/lib/dir_utils.dart
@@ -446,62 +446,4 @@ class DirUtils {
return false;
}
}
-
- /// Create a subdirectory.
- Future<bool> createDirectory(
- PickedDirectory dir,
- String subPath,
- ) async {
- if (Platform.isAndroid && dir.treeUri != null) {
- // SAF creates directories automatically when writing files
- return true;
- } else if (Platform.isIOS && dir.bookmark != null) {
- return _createDirectoryIos(dir, subPath);
- } else {
- return _createDirectoryOther(dir.path, subPath);
- }
- }
-
- Future<bool> _createDirectoryIos(PickedDirectory dir, String subPath) async {
- try {
- final fullPath = '${dir.path}/$subPath';
- final result = await _channel.invokeMethod<bool>(
- 'createDirectory',
- {'path': fullPath},
- );
- return result ?? false;
- } on PlatformException catch (e) {
- _logger.severe('iOS: Failed to create directory: ${e.message}');
- return false;
- }
- }
-
- Future<bool> _createDirectoryOther(String basePath, String subPath) async {
- try {
- await Directory('$basePath/$subPath').create(recursive: true);
- return true;
- } catch (e) {
- _logger.severe('Other: Failed to create directory: $e');
- return false;
- }
- }
-
- /// Check if a path exists.
- Future<bool> exists(PickedDirectory dir, {String? subPath}) async {
- if (Platform.isIOS && dir.bookmark != null) {
- try {
- final fullPath = subPath != null ? '${dir.path}/$subPath' : dir.path;
- final result = await _channel.invokeMethod<bool>(
- 'exists',
- {'path': fullPath},
- );
- return result ?? false;
- } on PlatformException {
- return false;
- }
- } else {
- final fullPath = subPath != null ? '${dir.path}/$subPath' : dir.path;
- return Directory(fullPath).existsSync() || File(fullPath).existsSync();
- }
- }
}