mirror of
https://github.com/sinai-dev/UnityExplorer.git
synced 2025-06-16 22:27:45 +08:00
Use Paths.BepInExRootPath, and cleanup dirs
This commit is contained in:
parent
91671bf243
commit
0d10f94eb5
@ -87,9 +87,6 @@ namespace UnityExplorer.Core.Config
|
||||
foreach (var entry in ConfigManager.InternalConfigs)
|
||||
sec.AddKey(entry.Key, entry.Value.BoxedValue.ToString());
|
||||
|
||||
if (!Directory.Exists(ExplorerCore.Loader.ConfigFolder))
|
||||
Directory.CreateDirectory(ExplorerCore.Loader.ConfigFolder);
|
||||
|
||||
File.WriteAllText(INI_PATH, data.ToString());
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ namespace UnityExplorer
|
||||
#if ML
|
||||
Path.Combine("MelonLoader", "Managed")
|
||||
#elif BIE
|
||||
Path.Combine("BepInEx", "unhollowed")
|
||||
Path.Combine(BepInEx.Paths.BepInExRootPath, "unhollowed")
|
||||
#else
|
||||
Path.Combine(ExplorerCore.Loader.ExplorerFolder, "Modules")
|
||||
#endif
|
||||
|
@ -46,7 +46,6 @@ namespace UnityExplorer
|
||||
private static readonly Harmony s_harmony = new Harmony(ExplorerCore.GUID);
|
||||
|
||||
public string ExplorerFolder => Path.Combine(Paths.PluginPath, ExplorerCore.NAME);
|
||||
public string ConfigFolder => Path.Combine(Paths.ConfigPath, ExplorerCore.NAME);
|
||||
|
||||
public Action<object> OnLogMessage => LogSource.LogMessage;
|
||||
public Action<object> OnLogWarning => LogSource.LogWarning;
|
||||
|
@ -10,7 +10,6 @@ namespace UnityExplorer
|
||||
{
|
||||
string ExplorerFolder { get; }
|
||||
|
||||
string ConfigFolder { get; }
|
||||
ConfigHandler ConfigHandler { get; }
|
||||
|
||||
Action<object> OnLogMessage { get; }
|
||||
|
@ -27,7 +27,6 @@ namespace UnityExplorer
|
||||
public static ExplorerMelonMod Instance;
|
||||
|
||||
public string ExplorerFolder => Path.Combine("Mods", ExplorerCore.NAME);
|
||||
public string ConfigFolder => ExplorerFolder;
|
||||
|
||||
public ConfigHandler ConfigHandler => _configHandler;
|
||||
public MelonLoaderConfigHandler _configHandler;
|
||||
|
@ -76,8 +76,6 @@ namespace UnityExplorer
|
||||
}
|
||||
private static string s_explorerFolder;
|
||||
|
||||
public string ConfigFolder => ExplorerFolder;
|
||||
|
||||
Action<object> IExplorerLoader.OnLogMessage => (object log) => { OnLog?.Invoke(log?.ToString() ?? "", LogType.Log); };
|
||||
Action<object> IExplorerLoader.OnLogWarning => (object log) => { OnLog?.Invoke(log?.ToString() ?? "", LogType.Warning); };
|
||||
Action<object> IExplorerLoader.OnLogError => (object log) => { OnLog?.Invoke(log?.ToString() ?? "", LogType.Error); };
|
||||
|
@ -13,11 +13,11 @@ namespace UnityExplorer.Loader.STANDALONE
|
||||
public class StandaloneConfigHandler : ConfigHandler
|
||||
{
|
||||
internal static IniDataParser _parser;
|
||||
internal static string INI_PATH;
|
||||
internal static string CONFIG_PATH;
|
||||
|
||||
public override void Init()
|
||||
{
|
||||
INI_PATH = Path.Combine(ExplorerCore.Loader.ConfigFolder, "config.ini");
|
||||
CONFIG_PATH = Path.Combine(ExplorerCore.Loader.ExplorerFolder, "config.ini");
|
||||
_parser = new IniDataParser();
|
||||
_parser.Configuration.CommentString = "#";
|
||||
}
|
||||
@ -49,10 +49,10 @@ namespace UnityExplorer.Loader.STANDALONE
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!File.Exists(INI_PATH))
|
||||
if (!File.Exists(CONFIG_PATH))
|
||||
return false;
|
||||
|
||||
string ini = File.ReadAllText(INI_PATH);
|
||||
string ini = File.ReadAllText(CONFIG_PATH);
|
||||
|
||||
var data = _parser.Parse(ini);
|
||||
|
||||
@ -97,10 +97,10 @@ namespace UnityExplorer.Loader.STANDALONE
|
||||
foreach (var entry in ConfigManager.ConfigElements)
|
||||
sec.AddKey(entry.Key, entry.Value.BoxedValue.ToString());
|
||||
|
||||
if (!Directory.Exists(ExplorerCore.Loader.ConfigFolder))
|
||||
Directory.CreateDirectory(ExplorerCore.Loader.ConfigFolder);
|
||||
if (!Directory.Exists(ExplorerCore.Loader.ExplorerFolder))
|
||||
Directory.CreateDirectory(ExplorerCore.Loader.ExplorerFolder);
|
||||
|
||||
File.WriteAllText(INI_PATH, data.ToString());
|
||||
File.WriteAllText(CONFIG_PATH, data.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user