PathHelper.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. 
  2. using System;
  3. using System.Text;
  4. using UnityEngine;
  5. namespace Model
  6. {
  7. public static class PathHelper
  8. { /// <summary>
  9. ///应用程序外部资源路径存放路径(热更新资源路径)
  10. /// </summary>
  11. public static string AppHotfixResPath
  12. {
  13. get
  14. {
  15. string game = Application.productName;
  16. string path = AppResPath;
  17. if (Application.isMobilePlatform)
  18. {
  19. path = $"{Application.persistentDataPath}/{game}/";
  20. }
  21. return path;
  22. }
  23. }
  24. /// <summary>
  25. /// 应用程序内部资源路径存放路径
  26. /// </summary>
  27. public static string AppResPath
  28. {
  29. get
  30. {
  31. string path = string.Empty;
  32. switch (Application.platform)
  33. {
  34. case RuntimePlatform.Android:
  35. path = $"jar:file://{Application.dataPath}!!/assets/";
  36. break;
  37. case RuntimePlatform.IPhonePlayer:
  38. path = $"{Application.dataPath}/Raw/";
  39. break;
  40. default:
  41. path = $"{Application.dataPath}/StreamingAssets/";
  42. break;
  43. }
  44. return path;
  45. }
  46. }
  47. }
  48. }