Skip to content

armgit / ente

Public Imported from GitHub
0

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

add getCustomCacheDirectory API

Abhinav67b887291529
diff --git a/src/api/cache.ts b/src/api/cache.ts
index a9aa00bde6..f2131f538a 100644
--- a/src/api/cache.ts
+++ b/src/api/cache.ts
@@ -6,9 +6,7 @@ import { DiskCache } from '../services/diskCache';
const ENTE_CACHE_DIR_NAME = 'ente';
const getCacheDir = async () => {
- const customCacheDir = await ipcRenderer.invoke(
- 'get-custom-cache-directory'
- );
+ const customCacheDir = await getCustomCacheDirectory();
if (customCacheDir && existsSync(customCacheDir)) {
return customCacheDir;
}
@@ -43,6 +41,12 @@ export async function deleteDiskCache(cacheName: string) {
}
}
-export async function setCustomCacheDirectory(directory: string) {
+export async function setCustomCacheDirectory(
+ directory: string
+): Promise<void> {
await ipcRenderer.invoke('set-custom-cache-directory', directory);
}
+
+export async function getCustomCacheDirectory(): Promise<string> {
+ return await ipcRenderer.invoke('get-custom-cache-directory');
+}
diff --git a/src/preload.ts b/src/preload.ts
index 76be59d241..3dbc501b65 100644
--- a/src/preload.ts
+++ b/src/preload.ts
@@ -30,6 +30,7 @@ import {
openDiskCache,
deleteDiskCache,
setCustomCacheDirectory,
+ getCustomCacheDirectory,
} from './api/cache';
import {
checkExistsAndCreateDir,
@@ -124,4 +125,5 @@ windowObject['ElectronAPIs'] = {
computeTextEmbedding,
getPlatform,
setCustomCacheDirectory,
+ getCustomCacheDirectory,
};