-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFileSystem.cs
31 lines (26 loc) · 1.03 KB
/
FileSystem.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
using SALT.Utils;
using System.IO;
using System.Reflection;
using UnityEngine;
namespace SALT
{
public static class FileSystem
{
public const string DataPath = "Smol Ame_Data";
public const string ModPath = "SALT/Mods";
public const string LibPath = "SALT/Libs";
public static string CheckDirectory(string path)
{
if (!Directory.Exists(path))
Directory.CreateDirectory(path);
return path;
}
public static string GetMyPath()
{
Assembly relevantAssembly = ReflectionUtils.GetRelevantAssembly();
return ModLoader.GetModForAssembly(relevantAssembly)?.Path ?? Path.GetDirectoryName(relevantAssembly.Location);
}
internal static string GetConfigPath(Mod mod) => FileSystem.CheckDirectory(Path.Combine(Path.Combine(Application.persistentDataPath, "SALT/Config"), mod?.ModInfo.Id ?? "SALT"));
public static string GetMyConfigPath() => FileSystem.GetConfigPath(Mod.GetCurrentMod());
}
}