From 38db03c3a02d260bab0020b98f5bd9d9a2754a74 Mon Sep 17 00:00:00 2001 From: Manav Rathi Date: Sat, 13 Apr 2024 21:50:56 +0530 Subject: [PATCH] Start giving it more power --- web/apps/photos/src/utils/native-fs.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/web/apps/photos/src/utils/native-fs.ts b/web/apps/photos/src/utils/native-fs.ts index 9db1a90b1..c35c0cd8f 100644 --- a/web/apps/photos/src/utils/native-fs.ts +++ b/web/apps/photos/src/utils/native-fs.ts @@ -1,3 +1,11 @@ +/** + * @file Native filesystem access using custom Node.js functionality provided by + * our desktop app. + * + * Precondition: Unless mentioned otherwise, the functions in these file only + * work when we are running in our desktop app. + */ + import { ensureElectron } from "@/next/electron"; import { nameAndExtension } from "@/next/file"; import sanitize from "sanitize-filename"; @@ -69,4 +77,8 @@ export const safeFileName = async (directoryPath: string, name: string) => { return result; }; -const exists = (path: string) => ensureElectron().fs.exists(path); +/** + * Return true if an item exists an the given {@link path} on the user's local + * filesystem. + */ +export const exists = (path: string) => ensureElectron().fs.exists(path);