1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-01-31 12:13:43 +01:00

Add models warning

This commit is contained in:
Feenix 2023-04-14 15:41:38 +05:30
parent 29ad1225fe
commit a93fe96b65
2 changed files with 26 additions and 0 deletions

View File

@ -228,6 +228,21 @@ ipcMain.handle(commands.SELECT_CUSTOM_MODEL_FOLDER, async (event, message) => {
log.log("Custom Folder Path: ", folderPaths[0]);
customModelsFolderPath = folderPaths[0];
if (
!folderPaths[0].endsWith("models") ||
!folderPaths[0].endsWith("models/")
) {
const options: MessageBoxOptions = {
type: "error",
title: "Invalid Folder",
message:
"Please make sure that the folder name is 'models' and nothing else.",
buttons: ["OK"],
};
dialog.showMessageBoxSync(options);
return null;
}
mainWindow.webContents.send(
commands.CUSTOM_MODEL_FILES_LIST,
getModels(customModelsFolderPath)

View File

@ -194,6 +194,17 @@ electron_1.ipcMain.handle(commands_1.default.SELECT_CUSTOM_MODEL_FOLDER, (event,
else {
electron_log_1.default.log("Custom Folder Path: ", folderPaths[0]);
customModelsFolderPath = folderPaths[0];
if (!folderPaths[0].endsWith("models") ||
!folderPaths[0].endsWith("models/")) {
const options = {
type: "error",
title: "Invalid Folder",
message: "Please make sure that the folder name is 'models' and nothing else.",
buttons: ["OK"],
};
electron_1.dialog.showMessageBoxSync(options);
return null;
}
mainWindow.webContents.send(commands_1.default.CUSTOM_MODEL_FILES_LIST, getModels(customModelsFolderPath));
return customModelsFolderPath;
}