bugfix:path error in windows

This commit is contained in:
locolocoer 2025-01-24 15:29:15 +08:00
parent 29ddfe41f5
commit 3bfb96b091

View File

@ -565,14 +565,19 @@ const handleRandomProxyName = () => {
`df_${editForm.value.type}_${result}`.toLocaleLowerCase(); `df_${editForm.value.type}_${result}`.toLocaleLowerCase();
}; };
import path from "path";
function normalizePath(filePath: string) {
return path.normalize(filePath).replace(/\\/g, "/");
}
const handleSelectFile = (type: number, ext: string[]) => { const handleSelectFile = (type: number, ext: string[]) => {
ipcRenderer.invoke("file.selectFile", ext).then(r => { ipcRenderer.invoke("file.selectFile", ext).then(r => {
switch (type) { switch (type) {
case 1: case 1:
editForm.value.https2httpCaFile = r[0]; editForm.value.https2httpCaFile = normalizePath(r[0]);
break; break;
case 2: case 2:
editForm.value.https2httpKeyFile = r[0]; editForm.value.https2httpKeyFile = normalizePath(r[0]);
break; break;
} }
console.log(r); console.log(r);