using UnityEditor; using UnityEngine; public class SVNExpand : Editor { /// <summary> /// 项目资源地址 /// </summary> static string SVNProjectPath = Application.dataPath; static string ProjectSettings = FileTools.GetParentPath(SVNProjectPath) + "/ProjectSettings"; static string UnityFrame = FileTools.GetParentPath(SVNProjectPath) + "/UnityFrame"; [MenuItem("SVN/更新资源 %g", false, 11)] static void SVNUpdate() { System.Diagnostics.Process.Start("TortoiseProc.exe", "/command:update /path:" + SVNProjectPath + "*" + ProjectSettings + "*" + UnityFrame + " /closeonend:0"); } [MenuItem("SVN/提交资源 %t", false, 12)] static void SVNCommit() { System.Diagnostics.Process.Start("TortoiseProc.exe", "/command:commit /path:" + SVNProjectPath + "*" + ProjectSettings + " /closeonend:0"); } [MenuItem("SVN/打开项目文件夹", false, 71)] static void ShowProjectExplorer() { System.Diagnostics.Process.Start("explorer.exe", "file:///" + SVNProjectPath); } [MenuItem("SVN/打开日志", false, 72)] static void SVNLog() { System.Diagnostics.Process.Start("TortoiseProc.exe", "/command:log /path:" + SVNProjectPath + " /closeonend:0"); } }
注意:
一般我在开发的过程中会修改到编辑器的设置,比如常用的Tag和打包设置,所以我们也把ProjectSettings目录也加进去更新目录,多个path用"*"连接。
FileTools.GetParentPath() 是获取上一层路径的方法。