OldBlueWater/BlueWater/Assets/02.Scripts/Utility/SystemPath.cs
2024-05-02 16:36:39 +09:00

46 lines
1.8 KiB
C#

using System.IO;
using UnityEngine;
namespace BlueWaterProject
{
public class SystemPath
{
public static string GetPath(string fileName)
{
string path = GetPath();
return Path.Combine(GetPath(), fileName);
}
public static string GetPath()
{
string path = null;
switch (Application.platform)
{
case RuntimePlatform.Android:
path = Application.persistentDataPath;
path = path.Substring(0, path.LastIndexOf('/'));
return Path.Combine(path, "Resources/");
case RuntimePlatform.IPhonePlayer:
path = Application.persistentDataPath;
path = path.Substring(0, path.LastIndexOf('/'));
return Path.Combine(path, "Documents");
case RuntimePlatform.OSXEditor:
path = Application.dataPath;
path = path.Substring(0, path.LastIndexOf('/'));
return Path.Combine(path, "Assets", "Resources/");
case RuntimePlatform.OSXPlayer:
path = Application.persistentDataPath;
path = path.Substring(0, path.LastIndexOf('/'));
return Path.Combine(path, "Assets", "Resources/");
case RuntimePlatform.WindowsEditor:
path = Application.dataPath;
path = path.Substring(0, path.LastIndexOf('/'));
return Path.Combine(path, "Assets", "Resources/");
default:
path = Application.dataPath;
path = path.Substring(0, path.LastIndexOf('/'));
return Path.Combine(path, "Resources/");
}
}
}
}