1
0
mirror of https://github.com/upscayl/upscayl.git synced 2025-01-31 04:03:51 +01:00

added platform checks

This commit is contained in:
TGS963 2023-04-23 20:09:28 +05:30
parent 55bc31efc1
commit 68ba34b9d6

View File

@ -163,8 +163,8 @@ ipcMain.handle(commands.SELECT_FILE, async () => {
return null;
} else {
logit("Selected File Path: ", filePaths[0]);
imagePath = filePaths[0].replace(new RegExp(escapeRegExp('\\'), 'g'), '\\\\');
const platform = getPlatform();
imagePath = platform === "win" ? filePaths[0].replace(new RegExp(escapeRegExp('\\'), 'g'), '\\\\') : filePaths[0];
mainWindow.webContents
.executeJavaScript(
`localStorage.setItem("lastImagePath", "${imagePath}");`,
@ -218,7 +218,8 @@ ipcMain.handle(commands.SELECT_FOLDER, async (event, message) => {
return null;
} else {
logit("Selected Folder Path: ", folderPaths[0]);
folderPath = folderPaths[0].replace(new RegExp(escapeRegExp('\\'), 'g'), '\\\\');;
const platform = getPlatform();
folderPath = platform === "win" ? folderPaths[0].replace(new RegExp(escapeRegExp('\\'), 'g'), '\\\\') : folderPaths[0];
mainWindow.webContents
.executeJavaScript(
`localStorage.setItem("lastFolderPath", "${folderPath}");`,