39 lines
1012 B
C#
39 lines
1012 B
C#
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}");
|
||
}
|
||
}
|
||
}
|