using System.IO;
using UnityEngine;
public class SaveFile : MonoBehaviour
{
void Start()
{
}
void Update()
{
if (Input.GetKeyDown(KeyCode.Q))
{
OpenDirectory(Application.streamingAssetsPath, false);
}
}
public static void OpenDirectory(string path, bool isFile = false)
{
if (string.IsNullOrEmpty(path)) return;
path = path.Replace("/", "\\");
if (isFile)
{
if (!File.Exists(path))
{
Debug.LogError("No File: " + path);
return;
}
path = string.Format("/Select, {0}", path);
}
else
{
if (!Directory.Exists(path))
{
Debug.LogError("No Directory: " + path);
return;
}
}
//可能360不信任
System.Diagnostics.Process.Start("explorer.exe", path);
}
}