Improve valid vencord install checks
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { app, dialog, ipcMain, session, shell } from "electron";
|
||||
import { existsSync, mkdirSync, readFileSync, watch } from "fs";
|
||||
import { mkdirSync, readFileSync, watch } from "fs";
|
||||
import { open, readFile } from "fs/promises";
|
||||
import { release } from "os";
|
||||
import { join } from "path";
|
||||
@@ -17,7 +17,7 @@ import { autoStart } from "./autoStart";
|
||||
import { VENCORD_FILES_DIR, VENCORD_QUICKCSS_FILE, VENCORD_THEMES_DIR } from "./constants";
|
||||
import { mainWin } from "./mainWindow";
|
||||
import { Settings } from "./settings";
|
||||
import { FILES_TO_DOWNLOAD } from "./utils/vencordLoader";
|
||||
import { isValidVencordInstall } from "./utils/vencordLoader";
|
||||
|
||||
ipcMain.on(IpcEvents.GET_VENCORD_PRELOAD_FILE, e => {
|
||||
e.returnValue = join(VENCORD_FILES_DIR, "vencordDesktopPreload.js");
|
||||
@@ -112,9 +112,7 @@ ipcMain.handle(IpcEvents.SELECT_VENCORD_DIR, async () => {
|
||||
if (!res.filePaths.length) return "cancelled";
|
||||
|
||||
const dir = res.filePaths[0];
|
||||
for (const file of FILES_TO_DOWNLOAD) {
|
||||
if (!existsSync(join(dir, file))) return "invalid";
|
||||
}
|
||||
if (!isValidVencordInstall(dir)) return "invalid";
|
||||
|
||||
return dir;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user