Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix url path special cases #332

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions Assets/YooAsset/Runtime/DownloadSystem/DownloadSystemHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,26 +25,28 @@ public static UnityWebRequest NewUnityWebRequestGet(string requestURL)
/// </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();
throw new System.NotImplementedException();
#endif
return urlPath.Replace("+", "%2B").Replace("#", "%23").Replace("?", "%3F");
}
}
}