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

 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     }

 

posted @ 2019-10-14 13:59  AaronBlogs  阅读(3873)  评论(0编辑  收藏  举报