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

来源:互联网 发布:微信群淘宝客有危险吗 编辑:程序博客网 时间:2024/06/05 18:45

最近在学习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('/','\\'));//打开文件夹


0 0
原创粉丝点击