mirror of
https://github.com/upscayl/upscayl.git
synced 2025-01-31 04:03:51 +01:00
fixed windows pathname errors
This commit is contained in:
parent
9ebc802718
commit
55bc31efc1
@ -32,6 +32,10 @@ import commands from "./commands";
|
|||||||
|
|
||||||
log.initialize({ preload: true });
|
log.initialize({ preload: true });
|
||||||
|
|
||||||
|
function escapeRegExp(string) {
|
||||||
|
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string
|
||||||
|
}
|
||||||
|
|
||||||
// Prepare the renderer once the app is ready
|
// Prepare the renderer once the app is ready
|
||||||
let mainWindow: BrowserWindow;
|
let mainWindow: BrowserWindow;
|
||||||
app.on("ready", async () => {
|
app.on("ready", async () => {
|
||||||
@ -160,7 +164,7 @@ ipcMain.handle(commands.SELECT_FILE, async () => {
|
|||||||
} else {
|
} else {
|
||||||
logit("Selected File Path: ", filePaths[0]);
|
logit("Selected File Path: ", filePaths[0]);
|
||||||
|
|
||||||
imagePath = filePaths[0];
|
imagePath = filePaths[0].replace(new RegExp(escapeRegExp('\\'), 'g'), '\\\\');
|
||||||
mainWindow.webContents
|
mainWindow.webContents
|
||||||
.executeJavaScript(
|
.executeJavaScript(
|
||||||
`localStorage.setItem("lastImagePath", "${imagePath}");`,
|
`localStorage.setItem("lastImagePath", "${imagePath}");`,
|
||||||
@ -214,7 +218,7 @@ ipcMain.handle(commands.SELECT_FOLDER, async (event, message) => {
|
|||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
logit("Selected Folder Path: ", folderPaths[0]);
|
logit("Selected Folder Path: ", folderPaths[0]);
|
||||||
folderPath = folderPaths[0];
|
folderPath = folderPaths[0].replace(new RegExp(escapeRegExp('\\'), 'g'), '\\\\');;
|
||||||
mainWindow.webContents
|
mainWindow.webContents
|
||||||
.executeJavaScript(
|
.executeJavaScript(
|
||||||
`localStorage.setItem("lastFolderPath", "${folderPath}");`,
|
`localStorage.setItem("lastFolderPath", "${folderPath}");`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user