From 1b31a87a918468dc752c34991ee25db0a71d1f84 Mon Sep 17 00:00:00 2001 From: fangxiang Date: Tue, 18 Jan 2022 16:35:19 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=92=AD=E6=94=BE=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=9C=A8Linux=E4=B8=8B=E8=B7=AF=E5=BE=84=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=9C=89=E9=97=AE=E9=A2=98=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PlaylistDialog.vue | 46 ++++++++++++++++++------------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/src/components/PlaylistDialog.vue b/src/components/PlaylistDialog.vue index 0a82105..75fd1ca 100644 --- a/src/components/PlaylistDialog.vue +++ b/src/components/PlaylistDialog.vue @@ -171,24 +171,22 @@ export default defineComponent({ } } catch {}*/ + console.log(prefix); + let temp_str = decodeURI(new URL(item).pathname).replace( + /\\/g, + "/" + ); if ( (GlobalData.getInstance().applicationConfig?.runtime_os ?? "UNKNOW") == "WINDOWS" ) { - let temp_str = decodeURI(new URL(item).pathname) - .substr(1) - .replace(/\\/g, "/"); - if (temp_str.startsWith(prefix)) { - temp_str = temp_str.substr(prefix.length + 1); - } - play_list.value.push(temp_str); - } else { - let temp_str = decodeURI(new URL(item).pathname).replace( - /\\/g, - "/" - ); - play_list.value.push(temp_str); + temp_str = temp_str.substr(1); } + + if (temp_str.startsWith(prefix)) { + temp_str = temp_str.substr(prefix.length + 1); + } + play_list.value.push(temp_str); } catch (e) { console.warn(e); } @@ -267,16 +265,26 @@ export default defineComponent({ const temp = GlobalData.getInstance().applicationConfig ?.application_data_dir ?? ""; + console.log(temp); let str = ""; for (const item of play_list.value) { try { - if (item.startsWith("/")) { - str += item + ";"; - } else if (item[1] == ":") { - // windows 盘符 - str += "file:///" + (item + ";"); + if ( + (GlobalData.getInstance().applicationConfig?.runtime_os ?? + "UNKNOW") == "WINDOWS" + ) { + /** windows */ + if (item.startsWith("/")) { + str += item + ";"; + } else if (item[1] == ":") { + // windows 盘符 + str += "file:///" + (item + ";"); + } else { + str += new URL(temp + "/" + item).toString() + ";"; + } } else { - str += new URL(temp + "/" + item).toString() + ";"; + /** linux */ + str += item + ";"; } } catch (e) { console.log(e);