Skip to content

armgit / ente

Public Imported from GitHub
0

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

Store remote data in ApplicationSupportDirectory

vishnukvmdbce30d772902
diff --git a/lib/services/remote_assets_service.dart b/lib/services/remote_assets_service.dart
index 8a11f84a46..bb9726a671 100644
--- a/lib/services/remote_assets_service.dart
+++ b/lib/services/remote_assets_service.dart
@@ -27,7 +27,7 @@ class RemoteAssetsService {
}
Future<String> _getLocalPath(String remotePath) async {
- return (await getTemporaryDirectory()).path +
+ return (await getApplicationSupportDirectory()).path +
"/assets/" +
_urlToFileName(remotePath);
}
diff --git a/lib/services/semantic_search/frameworks/ml_framework.dart b/lib/services/semantic_search/frameworks/ml_framework.dart
index 3523c721eb..ad2b26654e 100644
--- a/lib/services/semantic_search/frameworks/ml_framework.dart
+++ b/lib/services/semantic_search/frameworks/ml_framework.dart
@@ -2,7 +2,6 @@ import "dart:async";
import "dart:io";
import "package:connectivity_plus/connectivity_plus.dart";
-import "package:flutter/services.dart";
import "package:logging/logging.dart";
import "package:path/path.dart";
import "package:path_provider/path_provider.dart";
@@ -134,13 +133,13 @@ abstract class MLFramework {
}
Future<String> _getLocalImageModelPath() async {
- return (await getTemporaryDirectory()).path +
+ return (await getApplicationSupportDirectory()).path +
"/models/" +
basename(getImageModelRemotePath());
}
Future<String> _getLocalTextModelPath() async {
- return (await getTemporaryDirectory()).path +
+ return (await getApplicationSupportDirectory()).path +
"/models/" +
basename(getTextModelRemotePath());
}
@@ -176,17 +175,6 @@ abstract class MLFramework {
return connectivityResult != ConnectivityResult.mobile ||
shouldDownloadOverMobileData;
}
-
- Future<String> getAccessiblePathForAsset(
- String assetPath,
- String tempName,
- ) async {
- final byteData = await rootBundle.load(assetPath);
- final tempDir = await getTemporaryDirectory();
- final file = await File('${tempDir.path}/$tempName')
- .writeAsBytes(byteData.buffer.asUint8List());
- return file.path;
- }
}
class MLFrameworkInitializationUpdateEvent extends Event {