zl程序教程

您现在的位置是:首页 >  其他

当前栏目

unity 如何打开本地文件夹,并选中文件

文件 如何 本地 打开 Unity 文件夹 选中
2023-09-14 08:57:45 时间
 1 public static void OpenDirectory(string path, bool isFile = false)
 2     {
 3         if (string.IsNullOrEmpty(path)) return;
 4         path = path.Replace("/", "\\");
 5         if (isFile)
 6         {
 7             if (!File.Exists(path))
 8             {
 9                 Debug.LogError("No File: " + path);
10                 return;
11             }
12             path = string.Format("/Select, {0}", path);
13         }
14         else
15         {
16             if (!Directory.Exists(path))
17             {
18                 Debug.LogError("No Directory: " + path);
19                 return;
20             }
21         }
22         //可能360不信任
23         System.Diagnostics.Process.Start("explorer.exe", path);
24     }