Quantcast
Channel: CSDN博客移动开发推荐文章
Viewing all articles
Browse latest Browse all 5930

Unity3D开发小贴士(十六)SVN插件

$
0
0

这是针对Windows下的TortoiseSVN的插件,其他平台或软件的插件,以后可能会补上(也可能不补,看缘分吧)。

using UnityEngine;
using System.Diagnostics;
using UnityEditor;

#if UNITY_EDITOR_WIN
public static class TortoiseSVN
{

    const string SVN_EXE = "TortoiseProc.exe";
    const string PATH_CMD_FMT = "/command:{0} /path:{1} /closeonend:0";
    const string UPDATE_CMD = "update";
    const string COMMIT_CMD = "commit";

    static string GetCurrentPath()
    {
        return AssetDatabase.GetAssetPath(Selection.activeObject);
    }

    static string GetRootPath()
    {
        return Application.dataPath;
    }

    [MenuItem("Assets/SVN/Update", false, 100)]
    public static void Update()
    {
        Process.Start(SVN_EXE, string.Format(PATH_CMD_FMT, UPDATE_CMD, GetCurrentPath()));
    }

    [MenuItem("Assets/SVN/Commit", false, 101)]
    public static void Commit()
    {
        Process.Start(SVN_EXE, string.Format(PATH_CMD_FMT, COMMIT_CMD, GetCurrentPath()));
    }

    [MenuItem("Assets/SVN/UpdateAll", false, 200)]
    public static void UpdateAll()
    {
        Process.Start(SVN_EXE, string.Format(PATH_CMD_FMT, UPDATE_CMD, GetRootPath()));
    }

    [MenuItem("Assets/SVN/CommitAll", false, 201)]
    public static void CommitAll()
    {
        Process.Start(SVN_EXE, string.Format(PATH_CMD_FMT, COMMIT_CMD, GetRootPath()));
    }
}
#endif


作者:ecidevilin 发表于2017/5/27 14:11:02 原文链接
阅读:71 评论:0 查看评论

Viewing all articles
Browse latest Browse all 5930

Trending Articles