diff --git a/Unity/Assets/Scripts/Base/Log.cs b/Unity/Assets/Scripts/Base/Log.cs
index 9e54add3fa41cb09afa56f59766cf5d3272f215a..10792b815c1ad0c41d69b385ef91d67016f1aca9 100644
--- a/Unity/Assets/Scripts/Base/Log.cs
+++ b/Unity/Assets/Scripts/Base/Log.cs
@@ -10,20 +10,19 @@ namespace Model
private static readonly StreamWriter error;
-#if UNITY_EDITOR
- private static bool IsNeedFlush = true;
-#else
- private static bool IsNeedFlush = true;
-#endif
-
+ public static bool IsNeedFlush = true;
+ private static string dirName = "Logs";
+ private static string infoFileName = "/Log-Client-Info.txt";
+ private static string errorFileName = "/Log-Client-Error.txt";
static Log()
{
- if (!Directory.Exists("./Logs"))
+ string dirPath =PathHelp.AppHotfixResPath + dirName;
+ if (!Directory.Exists(dirPath))
{
- Directory.CreateDirectory("./Logs");
+ Directory.CreateDirectory(dirPath);
}
- info = new StreamWriter("./Logs/Log-Client-Info.txt", false, Encoding.Unicode, 1024);
- error = new StreamWriter("./Logs/Log-Client-Error.txt", false, Encoding.Unicode, 1024);
+ info = new StreamWriter(dirPath+ infoFileName, false, Encoding.Unicode, 1024);
+ error = new StreamWriter(dirPath+ errorFileName, false, Encoding.Unicode, 1024);
}
public static void Warning(string msg)
diff --git a/Unity/Assets/Scripts/Helper/PathHelp.cs b/Unity/Assets/Scripts/Helper/PathHelp.cs
new file mode 100644
index 0000000000000000000000000000000000000000..9db56e4b276ed3b120ded00fecd4c8bdda8a13c1
--- /dev/null
+++ b/Unity/Assets/Scripts/Helper/PathHelp.cs
@@ -0,0 +1,51 @@
+
+using System;
+using System.Text;
+using UnityEngine;
+
+namespace Model
+{
+ public static class PathHelp
+ { ///
+ ///应用程序外部资源路径存放路径(热更新资源路径)
+ ///
+ public static string AppHotfixResPath
+ {
+ get
+ {
+ string game = Application.productName;
+ string path = AppResPath;
+ if (Application.isMobilePlatform)
+ {
+ path = $"{Application.persistentDataPath} { "/"} {game} {"/"}";
+ }
+ return path;
+ }
+
+ }
+
+ ///
+ /// 应用程序内部资源路径存放路径
+ ///
+ public static string AppResPath
+ {
+ get
+ {
+ string path = string.Empty;
+ switch (Application.platform)
+ {
+ case RuntimePlatform.Android:
+ path = $"{"jar:file://"}{Application.dataPath}{"!!/assets/"}";
+ break;
+ case RuntimePlatform.IPhonePlayer:
+ path = $"{Application.dataPath}{"/Raw/"}";
+ break;
+ default:
+ path = $"{Application.dataPath}{"/StreamingAssets/"}";
+ break;
+ }
+ return path;
+ }
+ }
+ }
+}