Skip to content

Commit 6b6a873

Browse files
committed
Fix base directory on Mac OS
1 parent 8121dea commit 6b6a873

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

MOD.Scripts.Core.Config/MODConfigManager.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public static class MODConfigManager
1212
DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate
1313
};
1414

15-
private static readonly string ConfigFilePath = Path.Combine(Application.dataPath, "nipah.json");
15+
private static readonly string ConfigFilePath = Path.Combine(MODSystem.BaseDirectory, "nipah.json");
1616

1717
private static TextReader EmptyConfigReader => new StringReader("{}");
1818

MOD.Scripts.Core/MODSystem.cs

+17
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
using MOD.Scripts.Core.TextWindow;
44
using MOD.Scripts.UI;
55
using MOD.Scripts.UI.Tips;
6+
using UnityEngine;
7+
using System.IO;
68

79
namespace MOD.Scripts.Core
810
{
@@ -27,5 +29,20 @@ public class MODSystem
2729
public readonly MODTipsController modTipsController = fixedMODTipsControllerInstance;
2830

2931
private static readonly MODTipsController fixedMODTipsControllerInstance = new MODTipsController();
32+
33+
public static string BaseDirectory
34+
{
35+
get
36+
{
37+
if (Application.platform == RuntimePlatform.OSXPlayer)
38+
{
39+
return Path.Combine(Application.dataPath, "Resources/Data");
40+
}
41+
else
42+
{
43+
return Application.dataPath;
44+
}
45+
}
46+
}
3047
}
3148
}

MOD.Scripts.UI.Tips/MODTipsController.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@
44
using System.Collections.Generic;
55
using System.IO;
66
using UnityEngine;
7+
using MOD.Scripts.Core;
78

89
namespace MOD.Scripts.UI.Tips
910
{
1011
public class MODTipsController
1112
{
1213
private bool initialized;
1314
private Dictionary<int, List<TipsDataEntry>> fixedTips;
14-
private static readonly string TipsFilePath = Path.Combine(Application.dataPath, "tips.json");
15+
private static readonly string TipsFilePath = Path.Combine(MODSystem.BaseDirectory, "tips.json");
1516

1617
/// <summary>
1718
/// This returns the current tips for the arc.

0 commit comments

Comments
 (0)