Skip to content

Commit

Permalink
-Directory Creation occured too late during load, and has been changed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nagord committed Nov 22, 2022
1 parent 6819145 commit 58157e7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
7 changes: 0 additions & 7 deletions PulsarModLoader/Patches/PLGlobalStart.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,6 @@ static void Prefix()
//SaveDataManager Init()
new SaveData.SaveDataManager();

//Create ModConfigs Directory for SaveValue class
string ModConfigDir = SaveValueManager.GetConfigFolder();
if (!Directory.Exists(ModConfigDir))
{
Directory.CreateDirectory(ModConfigDir);
}

//ModLoading
string modsDir = Path.Combine(Directory.GetCurrentDirectory(), "Mods");
ModManager.Instance.LoadModsDirectory(modsDir);
Expand Down
9 changes: 8 additions & 1 deletion PulsarModLoader/SaveValue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,15 @@ internal static T GetValueFor<T>(string id, Assembly mod, T @default)

private static string GetConfigFile(Assembly mod)
{
//Create ModConfigs Directory for SaveValue class
string ModConfigDir = GetConfigFolder();
if (!Directory.Exists(ModConfigDir))
{
Directory.CreateDirectory(ModConfigDir);
}

if (ModToConfigFile.ContainsKey(mod)) return ModToConfigFile[mod];
string newFile = Path.Combine(GetConfigFolder(), mod.GetName().Name + ".json");
string newFile = Path.Combine(ModConfigDir, mod.GetName().Name + ".json");
ModToConfigFile.Add(mod, newFile);
if (!ModToCacheValues.ContainsKey(mod) && File.Exists(newFile))
ModToCacheValues.Add(mod, JsonConvert.DeserializeObject<Dictionary<string, string>>(File.ReadAllText(newFile)));
Expand Down

0 comments on commit 58157e7

Please sign in to comment.