From 5ca54b88fa22a4439345912dc6265a85f3957550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BD=95=E5=86=A0=E5=B3=B0?= Date: Fri, 27 Dec 2024 17:51:21 +0800 Subject: [PATCH] update download system --- .../DownloadSystem/DownloadSystemHelper.cs | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs index 1db7a872..52643569 100644 --- a/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs +++ b/Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs @@ -25,28 +25,32 @@ namespace YooAsset /// public static string ConvertToWWWPath(string path) { - string urlPath; + string url; + + // 获取对应平台的URL地址 #if UNITY_EDITOR - urlPath = StringUtility.Format("file:///{0}", path); + url = StringUtility.Format("file:///{0}", path); #elif UNITY_WEBGL - urlPath = path; + url = path; #elif UNITY_IPHONE - urlPath = StringUtility.Format("file://{0}", path); + url = StringUtility.Format("file://{0}", path); #elif UNITY_ANDROID if (path.StartsWith("jar:file://")) - urlPath = path; + url = path; else - urlPath = StringUtility.Format("jar:file://{0}", path); + url = StringUtility.Format("jar:file://{0}", path); #elif UNITY_STANDALONE_OSX - urlPath = new System.Uri(path).ToString(); + url = new System.Uri(path).ToString(); #elif UNITY_STANDALONE - urlPath = StringUtility.Format("file:///{0}", path); + url = StringUtility.Format("file:///{0}", path); #elif UNITY_OPENHARMONY - urlPath = StringUtility.Format("file://{0}", path); + url = StringUtility.Format("file://{0}", path); #else throw new System.NotImplementedException(); #endif - return urlPath.Replace("+", "%2B").Replace("#", "%23").Replace("?", "%3F"); + + // For some special cases when users have special characters in their devices, url paths can not be identified correctly. + return url.Replace("+", "%2B").Replace("#", "%23").Replace("?", "%3F"); } ///