blob: 7c23dd6b3cfe210ed82b6e7244c630a94d0aef87 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PathHelper{
// 用于bundle读取的streaming路径
// 不需要加file://协议
public static string GetStreamingFullFilePath(string filePath)
{
#if UNITY_ANDROID
return Application.dataPath + "!assets/" + filePath;
#else
return Application.streamingAssetsPath + "/" + filePath;
#endif
}
// 用于www读取的streaming路径
// 需要加file协议
public static string GetStreamingWWWFullFilePath(string filePath)
{
#if UNITY_ANDROID
return Application.streamingAssetsPath + "/" + filePath;
#else
return "file://" + Application.streamingAssetsPath + "/" + filePath;
#endif
}
public static string GetPersistentFullFilePath(string filePath)
{
return Application.persistentDataPath + "/" + filePath;
}
#if UNITY_IOS
// 将文件从自动上传iCloud中排除
public static void ExcludeFileFromiCloud(string filePath)
{
string full = GetPersistentFullFilePath(filePath);
UnityEngine.iOS.Device.SetNoBackupFlag(full);
}
#endif
}
|