/// <summary> /// Gets the GUIContent for opening the target of this result in the defined script editor. /// </summary> /// <returns>The content for script editor.</returns> protected static GUIContent GetContentForScriptEditor() { var editor = InternalEditorUtility.GetExternalScriptEditor().Equals("internal") ? "MonoDevelop" : "external"; return(new GUIContent(string.Format("Open in {0}", editor))); }
private static void OpenProjectFileUnlessInBatchMode() { if (InternalEditorUtility.inBatchMode) { return; } bool onlyCSharp = InternalEditorUtility.GetExternalScriptEditor().EndsWith("devenv.exe", StringComparison.OrdinalIgnoreCase); InternalEditorUtility.OpenFileAtLineExternal(SyncVS.Synchronizer.SolutionFile(onlyCSharp), -1); }
private static bool IsSelectedEditorVisualStudio() { string externalScriptEditor = InternalEditorUtility.GetExternalScriptEditor(); if (!externalScriptEditor.EndsWith("devenv.exe")) { return(externalScriptEditor.EndsWith("vcsexpress.exe")); } return(true); }
private static void OpenVisualStudioFile(string projectPath, string file, int line) { #if UNITY_2017_1_OR_NEWER string vsPath = ScriptEditorUtility.GetExternalScriptEditor(); #else string vsPath = InternalEditorUtility.GetExternalScriptEditor(); #endif if (IsNotWindowsEditor()) { Process.Start("open", "-a " + QuotePathIfNeeded(vsPath) + " " + QuotePathIfNeeded(file)); return; } if (string.IsNullOrEmpty(vsPath) || !File.Exists(vsPath)) { return; } string exePath = String.Empty; #if UNITY_2018_1_OR_NEWER var packageInfos = Packages.GetAll(); foreach (var packageInfo in packageInfos) { if (packageInfo.name == "com.wuhuan.consoletiny") { exePath = packageInfo.resolvedPath; // https://github.com/akof1314/VisualStudioFileOpenTool exePath = exePath + "\\Editor\\VisualStudioFileOpenTool.exe"; break; } } #elif UNITY_2017_1_OR_NEWER // TODO exePath = "../../PackagesCustom/com.wuhuan.consoletiny"; #endif if (string.IsNullOrEmpty(exePath)) { exePath = "Assets/Editor/VisualStudioFileOpenTool.exe"; } if (!string.IsNullOrEmpty(exePath)) { if (!File.Exists(exePath)) { return; } ThreadPool.QueueUserWorkItem(_ => { OpenVisualStudioFileInter(exePath, vsPath, projectPath, file, line); }); } }
public void OpenEditor(string projectPath, string file, int line) { m_SolutionFile = projectPath; if (m_ScriptOpenerType != null) { ThreadPool.QueueUserWorkItem(_ => { OpenEditorInter(projectPath, file, line); }); } else { #if UNITY_2017_1_OR_NEWER string vsPath = ScriptEditorUtility.GetExternalScriptEditor(); #else string vsPath = InternalEditorUtility.GetExternalScriptEditor(); #endif if (string.IsNullOrEmpty(vsPath) || !File.Exists(vsPath)) { return; } string exePath = String.Empty; #if UNITY_2018_1_OR_NEWER var packageInfos = Packages.GetAll(); foreach (var packageInfo in packageInfos) { if (packageInfo.name == "com.wuhuan.consoletiny") { exePath = packageInfo.resolvedPath; break; } } #elif UNITY_2017_1_OR_NEWER // TODO exePath = "../../PackagesCustom/com.wuhuan.consoletiny"; #endif if (!string.IsNullOrEmpty(exePath)) { exePath = exePath + "\\Editor\\VisualStudioFileOpenTool.exe"; ThreadPool.QueueUserWorkItem(_ => { OpenEditorInter2(exePath, vsPath, projectPath, file, line); }); } } }
private static bool IsSelectedEditorInternalMonoDevelop() { return(InternalEditorUtility.GetExternalScriptEditor() == "internal"); }
/// <summary> /// Retrieves path of an external script editor. e.g) path of where VisualStudio etc. /// </summary> public static string GetExternalScriptEditorPath() { return(InternalEditorUtility.GetExternalScriptEditor()); }