Pro-Ly 2024-12-11 10:34:11 +08:00 committed by GitHub
commit c121bcdf9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 9 deletions

View File

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