Start giving it more power

This commit is contained in:
Manav Rathi 2024-04-13 21:50:56 +05:30
parent e268b9204e
commit 38db03c3a0
No known key found for this signature in database

View file

@ -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);