0
0
mirror of https://github.com/sp-tarkov/modules.git synced 2025-02-13 08:50:43 -05:00
modules/project/SPT.Custom/Patches/SaveSettingsToSptFolderPatch.cs
Dev 24de63b705 Rename various patches for clarity
Disable `SetLocationIdOnRaidStartPatch` as it's not unnecessary
2024-07-11 11:18:00 +01:00

34 lines
930 B
C#

using SPT.Reflection.Patching;
using HarmonyLib;
using System;
using System.IO;
using System.Reflection;
namespace SPT.Custom.Patches
{
/// <summary>
/// Redirect the settings data to save into the SPT folder, not app data
/// </summary>
public class SaveSettingsToSptFolderPatch : ModulePatch
{
private static readonly string _sptPath = Path.Combine(Environment.CurrentDirectory, "user", "sptSettings");
protected override MethodBase GetTargetMethod()
{
return AccessTools.Constructor(typeof(SharedGameSettingsClass));
}
[PatchPrefix]
internal static void PatchPrefix(ref string ___string_0, ref string ___string_1)
{
if (!Directory.Exists(_sptPath))
{
Directory.CreateDirectory(_sptPath);
}
___string_0 = _sptPath;
___string_1 = _sptPath;
}
}
}