فهرست منبع

Remove text qualifier

The type already enforces that. And it reads better and the call sites this way.
Manav Rathi 1 سال پیش
والد
کامیت
3ea4879cf0
5فایلهای تغییر یافته به همراه14 افزوده شده و 14 حذف شده
  1. 1 1
      desktop/src/main/fs.ts
  2. 3 3
      desktop/src/main/ipc.ts
  3. 3 3
      desktop/src/preload.ts
  4. 3 3
      web/apps/photos/src/services/export/index.ts
  5. 4 4
      web/packages/next/types/ipc.ts

+ 1 - 1
desktop/src/main/fs.ts

@@ -20,7 +20,7 @@ export const fsRm = (path: string) => fs.rm(path);
 export const fsReadTextFile = async (filePath: string) =>
 export const fsReadTextFile = async (filePath: string) =>
     fs.readFile(filePath, "utf-8");
     fs.readFile(filePath, "utf-8");
 
 
-export const fsWriteTextFile = (path: string, contents: string) =>
+export const fsWriteFile = (path: string, contents: string) =>
     fs.writeFile(path, contents);
     fs.writeFile(path, contents);
 
 
 /**
 /**

+ 3 - 3
desktop/src/main/ipc.ts

@@ -24,7 +24,7 @@ import {
     fsRename,
     fsRename,
     fsRm,
     fsRm,
     fsRmdir,
     fsRmdir,
-    fsWriteTextFile,
+    fsWriteFile,
     isFolder,
     isFolder,
     saveStreamToDisk,
     saveStreamToDisk,
 } from "./fs";
 } from "./fs";
@@ -129,8 +129,8 @@ export const attachIPCHandlers = () => {
 
 
     ipcMain.handle("fsReadTextFile", (_, path: string) => fsReadTextFile(path));
     ipcMain.handle("fsReadTextFile", (_, path: string) => fsReadTextFile(path));
 
 
-    ipcMain.handle("fsWriteTextFile", (_, path: string, contents: string) =>
-        fsWriteTextFile(path, contents),
+    ipcMain.handle("fsWriteFile", (_, path: string, contents: string) =>
+        fsWriteFile(path, contents),
     );
     );
 
 
     // - Conversion
     // - Conversion

+ 3 - 3
desktop/src/preload.ts

@@ -115,8 +115,8 @@ const fsRm = (path: string): Promise<void> => ipcRenderer.invoke("fsRm", path);
 const fsReadTextFile = (path: string): Promise<string> =>
 const fsReadTextFile = (path: string): Promise<string> =>
     ipcRenderer.invoke("fsReadTextFile", path);
     ipcRenderer.invoke("fsReadTextFile", path);
 
 
-const fsWriteTextFile = (path: string, contents: string): Promise<void> =>
-    ipcRenderer.invoke("fsWriteTextFile", path, contents);
+const fsWriteFile = (path: string, contents: string): Promise<void> =>
+    ipcRenderer.invoke("fsWriteFile", path, contents);
 
 
 // - AUDIT below this
 // - AUDIT below this
 
 
@@ -326,7 +326,7 @@ contextBridge.exposeInMainWorld("electron", {
         rmdir: fsRmdir,
         rmdir: fsRmdir,
         rm: fsRm,
         rm: fsRm,
         readTextFile: fsReadTextFile,
         readTextFile: fsReadTextFile,
-        writeTextFile: fsWriteTextFile,
+        writeFile: fsWriteFile,
     },
     },
 
 
     // - Conversion
     // - Conversion

+ 3 - 3
web/apps/photos/src/services/export/index.ts

@@ -884,7 +884,7 @@ class ExportService {
         try {
         try {
             const exportRecord = await this.getExportRecord(folder);
             const exportRecord = await this.getExportRecord(folder);
             const newRecord: ExportRecord = { ...exportRecord, ...newData };
             const newRecord: ExportRecord = { ...exportRecord, ...newData };
-            await ensureElectron().fs.writeTextFile(
+            await ensureElectron().fs.writeFile(
                 `${folder}/${exportRecordFileName}`,
                 `${folder}/${exportRecordFileName}`,
                 JSON.stringify(newRecord, null, 2),
                 JSON.stringify(newRecord, null, 2),
             );
             );
@@ -1076,7 +1076,7 @@ class ExportService {
         fileExportName: string,
         fileExportName: string,
         file: EnteFile,
         file: EnteFile,
     ) {
     ) {
-        await ensureElectron().fs.writeTextFile(
+        await ensureElectron().fs.writeFile(
             getFileMetadataExportPath(collectionExportPath, fileExportName),
             getFileMetadataExportPath(collectionExportPath, fileExportName),
             getGoogleLikeMetadataFile(fileExportName, file),
             getGoogleLikeMetadataFile(fileExportName, file),
         );
         );
@@ -1105,7 +1105,7 @@ class ExportService {
 
 
     private createEmptyExportRecord = async (exportRecordJSONPath: string) => {
     private createEmptyExportRecord = async (exportRecordJSONPath: string) => {
         const exportRecord: ExportRecord = NULL_EXPORT_RECORD;
         const exportRecord: ExportRecord = NULL_EXPORT_RECORD;
-        await ensureElectron().fs.writeTextFile(
+        await ensureElectron().fs.writeFile(
             exportRecordJSONPath,
             exportRecordJSONPath,
             JSON.stringify(exportRecord, null, 2),
             JSON.stringify(exportRecord, null, 2),
         );
         );

+ 4 - 4
web/packages/next/types/ipc.ts

@@ -189,16 +189,16 @@ export interface Electron {
          */
          */
         rm: (path: string) => Promise<void>;
         rm: (path: string) => Promise<void>;
 
 
+        /** Read the string contents of a file at {@link path}. */
+        readTextFile: (path: string) => Promise<string>;
+
         /**
         /**
          * Write a string to a file, replacing the file if it already exists.
          * Write a string to a file, replacing the file if it already exists.
          *
          *
          * @param path The path of the file.
          * @param path The path of the file.
          * @param contents The string contents to write.
          * @param contents The string contents to write.
          */
          */
-        writeTextFile: (path: string, contents: string) => Promise<void>;
-
-        /** Read the string contents of a file at {@link path}. */
-        readTextFile: (path: string) => Promise<string>;
+        writeFile: (path: string, contents: string) => Promise<void>;
     };
     };
 
 
     /*
     /*