From 3bfb96b09113bed29fa35b17a7ad68db92971df2 Mon Sep 17 00:00:00 2001 From: locolocoer <1457901147@qq.com> Date: Fri, 24 Jan 2025 15:29:15 +0800 Subject: [PATCH] bugfix:path error in windows --- src/views/proxy/index.vue | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/views/proxy/index.vue b/src/views/proxy/index.vue index 055337a..989d0e1 100644 --- a/src/views/proxy/index.vue +++ b/src/views/proxy/index.vue @@ -565,14 +565,19 @@ const handleRandomProxyName = () => { `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[]) => { ipcRenderer.invoke("file.selectFile", ext).then(r => { switch (type) { case 1: - editForm.value.https2httpCaFile = r[0]; + editForm.value.https2httpCaFile = normalizePath(r[0]); break; case 2: - editForm.value.https2httpKeyFile = r[0]; + editForm.value.https2httpKeyFile = normalizePath(r[0]); break; } console.log(r);