FileUpload/Assets/Scripts/ProjectTool.cs
2025-02-27 16:14:18 +08:00

39 lines
1012 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using UnityEditor;
using UnityEngine;
public class ProjectTool
{
[MenuItem("项目工具/打开目录/项目日志记录2")]
static void OpenDebugLog2()
{
OpenFolder(LogSystem2025.mLogPath);
}
public static void OpenFolder(string path)
{
// 路径合法性检查
if (string.IsNullOrEmpty(path)) return;
// 路径格式转换支持Windows反斜杠
string formattedPath = path.Replace("/", "\\");
try
{
ProcessStartInfo startInfo = new ProcessStartInfo
{
FileName = "explorer.exe",
Arguments = formattedPath, // 直接传入路径
UseShellExecute = true // 启用系统Shell执行
};
Process.Start(startInfo);
}
catch (System.Exception e)
{
CDebug.LogError($"打开文件夹失败: {e.Message}");
}
}
}