mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
a2a997df30
* [*] ESLint: The Lintening * Missed a couple unused vals in utils * [*] Tend to DeepScan remarks * [*] sigh, remove some duplicate crap
20 lines
774 B
TypeScript
20 lines
774 B
TypeScript
import * as fs from "fs";
|
|
import {app, session} from "electron";
|
|
const userDataPath = app.getPath("userData");
|
|
const pluginFolder = `${userDataPath}/plugins`;
|
|
if (!fs.existsSync(pluginFolder)) {
|
|
fs.mkdirSync(pluginFolder);
|
|
console.log("Created missing plugin folder");
|
|
}
|
|
app.whenReady().then(() => {
|
|
fs.readdirSync(pluginFolder).forEach((file) => {
|
|
try {
|
|
const manifest = fs.readFileSync(`${pluginFolder}/${file}/manifest.json`, "utf8");
|
|
const pluginFile = JSON.parse(manifest);
|
|
session.defaultSession.loadExtension(`${pluginFolder}/${file}`);
|
|
console.log(`[Mod loader] Loaded ${pluginFile.name} made by ${pluginFile.author}`);
|
|
} catch (err) {
|
|
console.error(err);
|
|
}
|
|
});
|
|
});
|