Compare commits

...

2 Commits

Author SHA1 Message Date
Pro-Ly aee3d1a91b
Merge be3fa0b688 into cdaa45e163 2024-11-07 11:58:24 +08:00
Pro-Ly be3fa0b688 fix url path special cases 2024-07-31 23:28:47 +08:00
1 changed files with 11 additions and 9 deletions

View File

@ -25,26 +25,28 @@ namespace YooAsset
/// </summary> /// </summary>
public static string ConvertToWWWPath(string path) public static string ConvertToWWWPath(string path)
{ {
string urlPath;
#if UNITY_EDITOR #if UNITY_EDITOR
return StringUtility.Format("file:///{0}", path); urlPath = StringUtility.Format("file:///{0}", path);
#elif UNITY_WEBGL #elif UNITY_WEBGL
return path; urlPath = path;
#elif UNITY_IPHONE #elif UNITY_IPHONE
return StringUtility.Format("file://{0}", path); urlPath = StringUtility.Format("file://{0}", path);
#elif UNITY_ANDROID #elif UNITY_ANDROID
if (path.StartsWith("jar:file://")) if (path.StartsWith("jar:file://"))
return path; urlPath = path;
else else
return StringUtility.Format("jar:file://{0}", path); urlPath = StringUtility.Format("jar:file://{0}", path);
#elif UNITY_STANDALONE_OSX #elif UNITY_STANDALONE_OSX
return new System.Uri(path).ToString(); urlPath = new System.Uri(path).ToString();
#elif UNITY_STANDALONE #elif UNITY_STANDALONE
return StringUtility.Format("file:///{0}", path); urlPath = StringUtility.Format("file:///{0}", path);
#elif UNITY_OPENHARMONY #elif UNITY_OPENHARMONY
return StringUtility.Format("file://{0}", path); urlPath = StringUtility.Format("file://{0}", path);
#else #else
throw new System.NotImplementedException(); throw new System.NotImplementedException();
#endif #endif
return urlPath.Replace("+", "%2B").Replace("#", "%23").Replace("?", "%3F");
} }
} }
} }