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     }

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM