Skip to content

Commit

Permalink
fix store file to userData location
Browse files Browse the repository at this point in the history
Signed-off-by: seven <[email protected]>
  • Loading branch information
Blankll committed Feb 20, 2024
1 parent 15f4ccf commit cecdc3b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "DocKit",
"productName": "DocKit",
"private": true,
"version": "0.0.15",
"version": "0.0.16",
"description": "A faster, better and more stable NoSQL desktop tools",
"author": "geekfun <[email protected]>",
"license": "Apache-2.0",
Expand Down
3 changes: 3 additions & 0 deletions src/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { githubLink } from '../config';
import { registerStoreApiListener } from './storeApi';
import { registerSourceFileApiListener } from './sourceFIleApi';

declare const MAIN_WINDOW_VITE_DEV_SERVER_URL: string;
declare const MAIN_WINDOW_VITE_NAME: string;

const isDev = process.env.APP_ENV === 'dev';
// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) {
Expand Down
7 changes: 5 additions & 2 deletions src/electron/sourceFIleApi.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Electron from 'electron';
import Electron, { app } from 'electron';
import { readFile, writeFile, mkdir } from 'fs/promises';
import { existsSync } from 'fs';
import path from 'path';
Expand Down Expand Up @@ -52,6 +52,9 @@ const sourceFileApi: { [key: string]: (filePath: string, content: string) => unk

export const registerSourceFileApiListener = (ipcMain: Electron.IpcMain) => {
ipcMain.handle('sourceFileAPI', (_, { content, method }: SourceFileApiInput) =>
sourceFileApi[method.toLowerCase()]('../../data/default.search', content),
sourceFileApi[method.toLowerCase()](
`${app.getPath('userData')}/search/default.search`,
content,
),
);
};

0 comments on commit cecdc3b

Please sign in to comment.