From 38d4a551880f913a873c3d2c91a98f0434dfa4b2 Mon Sep 17 00:00:00 2001
From: chai <chaifix@163.com>
Date: Fri, 6 Mar 2020 00:30:31 +0800
Subject: +init

---
 Assets/Scripts/PathHelper.cs | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Assets/Scripts/PathHelper.cs

(limited to 'Assets/Scripts/PathHelper.cs')

diff --git a/Assets/Scripts/PathHelper.cs b/Assets/Scripts/PathHelper.cs
new file mode 100644
index 0000000..7c23dd6
--- /dev/null
+++ b/Assets/Scripts/PathHelper.cs
@@ -0,0 +1,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
+}
-- 
cgit v1.1-26-g67d0