您的位置:首页 > 移动开发 > Unity3D

System.Diagnostics.Process.Start操作文件和文件夹(Unity3D)

2015-03-19 15:54 447 查看
最近在学习U3D,会写一些脚本工具,操作文件。

比如在unity中打开文本:

var logPath = Application.persistentDataPath+"/log";

var fileName = new DirectoryInfo(logPath).GetFiles().OrderBy(t=>t.LastWriteTime).Last().FullName;//取到文本路径

System.Diagnostics.Process.Start(fileName);//打开文本

也是可以打开网址System.Diagnostics.Process.Start(http://baidu.com);

比如在unity中打开文件夹

var logPath = Application.persistentDataPath + "/log";

System.Diagnostics.Process.Start("explorer.exe",logPath.Replace('/','\\'));//打开文件夹


内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息