mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
fix theme loading
This commit is contained in:
parent
6f6a5b2ca8
commit
f2cfcbfb5d
3 changed files with 46 additions and 42 deletions
|
@ -54,21 +54,28 @@ export function createSettingsWindow(): void {
|
|||
fs.writeFileSync(path.join(userDataPath, "/disabled.txt"), "");
|
||||
}
|
||||
settingsWindow.webContents.on("did-finish-load", () => {
|
||||
if (!settingsWindow.webContents.isLoading()) {
|
||||
fs.readdirSync(themesFolder).forEach((file) => {
|
||||
try {
|
||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||
let themeFile = JSON.parse(manifest);
|
||||
fs.readdirSync(themesFolder).forEach((file) => {
|
||||
try {
|
||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||
let themeFile = JSON.parse(manifest);
|
||||
if (
|
||||
fs
|
||||
.readFileSync(path.join(userDataPath, "/disabled.txt"))
|
||||
.toString()
|
||||
.includes(themeFile.name.replace(" ", "-"))
|
||||
) {
|
||||
console.log(`%cSkipped ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||
} else {
|
||||
settingsWindow.webContents.send(
|
||||
"themeLoader",
|
||||
fs.readFileSync(`${themesFolder}/${file}/${themeFile.theme}`, "utf-8")
|
||||
);
|
||||
console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
ipcMain.on("saveSettings", (_event, args: Settings) => {
|
||||
console.log(args);
|
||||
|
|
|
@ -195,16 +195,15 @@ export function createTManagerWindow(): void {
|
|||
}
|
||||
});
|
||||
themeWindow.webContents.on("did-finish-load", () => {
|
||||
if (!themeWindow.webContents.isLoading()) {
|
||||
fs.readdirSync(themesFolder).forEach((file) => {
|
||||
try {
|
||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||
themeWindow.webContents.send("themeManifest", manifest);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
fs.readdirSync(themesFolder).forEach((file) => {
|
||||
try {
|
||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||
console.log(manifest);
|
||||
themeWindow.webContents.send("themeManifest", manifest);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
managerLoadPage();
|
||||
|
|
|
@ -195,30 +195,28 @@ async function doAfterDefiningTheWindow(): Promise<void> {
|
|||
fs.writeFileSync(path.join(userDataPath, "/disabled.txt"), "");
|
||||
}
|
||||
mainWindow.webContents.on("did-finish-load", () => {
|
||||
if (!mainWindow.webContents.isLoading()) {
|
||||
fs.readdirSync(themesFolder).forEach((file) => {
|
||||
try {
|
||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||
let themeFile = JSON.parse(manifest);
|
||||
if (
|
||||
fs
|
||||
.readFileSync(path.join(userDataPath, "/disabled.txt"))
|
||||
.toString()
|
||||
.includes(themeFile.name.replace(" ", "-"))
|
||||
) {
|
||||
console.log(`%cSkipped ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||
} else {
|
||||
mainWindow.webContents.send(
|
||||
"themeLoader",
|
||||
fs.readFileSync(`${themesFolder}/${file}/${themeFile.theme}`, "utf-8")
|
||||
);
|
||||
console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
fs.readdirSync(themesFolder).forEach((file) => {
|
||||
try {
|
||||
const manifest = fs.readFileSync(`${themesFolder}/${file}/manifest.json`, "utf8");
|
||||
let themeFile = JSON.parse(manifest);
|
||||
if (
|
||||
fs
|
||||
.readFileSync(path.join(userDataPath, "/disabled.txt"))
|
||||
.toString()
|
||||
.includes(themeFile.name.replace(" ", "-"))
|
||||
) {
|
||||
console.log(`%cSkipped ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||
} else {
|
||||
mainWindow.webContents.send(
|
||||
"themeLoader",
|
||||
fs.readFileSync(`${themesFolder}/${file}/${themeFile.theme}`, "utf-8")
|
||||
);
|
||||
console.log(`%cLoaded ${themeFile.name} made by ${themeFile.author}`, "color:red");
|
||||
}
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
});
|
||||
await setMenu();
|
||||
mainWindow.on("close", async (e) => {
|
||||
|
|
Loading…
Reference in a new issue