isValidVencordInstall: don't require package.json to exist
This commit is contained in:
+1
-1
@@ -149,7 +149,7 @@ handle(IpcEvents.SELECT_VENCORD_DIR, async (_e, value?: null) => {
|
|||||||
if (!res.filePaths.length) return "cancelled";
|
if (!res.filePaths.length) return "cancelled";
|
||||||
|
|
||||||
const dir = res.filePaths[0];
|
const dir = res.filePaths[0];
|
||||||
if (!isValidVencordInstall(dir)) return "invalid";
|
if (!(await isValidVencordInstall(dir))) return "invalid";
|
||||||
|
|
||||||
State.store.vencordDir = dir;
|
State.store.vencordDir = dir;
|
||||||
|
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ const existsAsync = (path: string) =>
|
|||||||
.catch(() => false);
|
.catch(() => false);
|
||||||
|
|
||||||
export async function isValidVencordInstall(dir: string) {
|
export async function isValidVencordInstall(dir: string) {
|
||||||
const results = await Promise.all(["package.json", ...FILES_TO_DOWNLOAD].map(f => existsAsync(join(dir, f))));
|
const results = await Promise.all(FILES_TO_DOWNLOAD.map(f => existsAsync(join(dir, f))));
|
||||||
return !results.includes(false);
|
return !results.includes(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user