-
Notifications
You must be signed in to change notification settings - Fork 1
/
Utility.OpenStack.cs
56 lines (51 loc) · 1.92 KB
/
Utility.OpenStack.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Diagnostics;
using Lib.Editor.Scriptable;
using UnityEditor;
using UnityEngine;
namespace Lib.Editor
{
public partial class CommonUtility
{
#if UNITY_EDITOR_WIN
[MenuItem("Assets/Open By/NotePad++")]
private static void NotePadPlusPlusRun()
{
var assetPaths = CommonUtility.GetSelectionAssetPaths(true);
OsRun(string.Join(" ", assetPaths.ToArray()), GlobalScriptableObject.Instance.strNotePadPpPath);
}
[MenuItem("Assets/Open By/Sublime Text")]
private static void SublimeTextRun()
{
var assetPaths = CommonUtility.GetSelectionAssetPaths(true);
OsRun(string.Join(" ", assetPaths.ToArray()), GlobalScriptableObject.Instance.strSublimePath);
}
[MenuItem("Assets/Open By/NotePad")]
private static void NotePadRun()
{
var assetPaths = CommonUtility.GetSelectionAssetPaths(true);
OsRun(string.Join(" ", assetPaths.ToArray()), GlobalScriptableObject.Instance.strNotePad);
}
[MenuItem("Assets/Open By/NotePad打开.Meta(选一个)")]
private static void OpenMeta()
{
var guids = Selection.assetGUIDs;
if (guids.Length == 1)
OsRun(Environment.CurrentDirectory + "/" + AssetDatabase.GUIDToAssetPath(guids[0]) + ".meta", GlobalScriptableObject.Instance.strNotePad);
}
private static void OsRun(string args, string exePath)
{
var workDirectory =
Application.dataPath.Remove(Application.dataPath.LastIndexOf("/Assets", StringComparison.Ordinal));
Process.Start(new ProcessStartInfo
{
UseShellExecute = false,
CreateNoWindow = true,
FileName = exePath,
Arguments = args,
WorkingDirectory = workDirectory
});
}
#endif
}
}