Files
PrinceOfGlory/Assets/Scripts/XRCore/Video/VideoPathUtil.cs
kridoo 6e91a0c7f0 111
2025-09-15 17:32:08 +08:00

46 lines
1.2 KiB
C#

using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
public class VideoPathUtil
{
private static string jarPrePath = "jar:file://";
private static string picoPath = "/storage/emulated/0/Download/dwkj_videos/";
public static string GetVideoUrlPath(string videoName)
{
#if UNITY_EDITOR
return VideoPathUtil.GetPcVideoPath(videoName);
#else
return jarPrePath + GetFilePath(picoPath, videoName);
#endif
}
private static string GetPcVideoPath()
{
return Path.GetFullPath(Application.streamingAssetsPath + "/../../Videos/");
}
private static string GetPcVideoPath(string videoUrl)
{
return Path.Combine(VideoPathUtil.GetPcVideoPath(), $"{videoUrl}");
}
private static string GetFilePath(string dirPath, string fileName)
{
DirectoryInfo direction = new DirectoryInfo(dirPath);
FileInfo[] files = direction.GetFiles();
foreach (var file in files)
{
string str = file.Name;
string str2 = $"{fileName}" ;
if (str == str2)
return file.FullName;
}
return "";
}
}