Last active
January 20, 2022 06:07
-
-
Save YclepticStudios/4b3ca870386ba355e8484711433a7701 to your computer and use it in GitHub Desktop.
Simple editor extension for launching GitBash via a keyboard shortcut and a menu item.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* ============================================================================ | |
* MIT License | |
* | |
* Copyright (c) 2017 Eric Phillips | |
* | |
* Permission is hereby granted, free of charge, to any person obtaining a | |
* copy of this software and associated documentation files (the "Software"), | |
* to deal in the Software without restriction, including without limitation | |
* the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
* and/or sell copies of the Software, and to permit persons to whom the | |
* Software is furnished to do so, subject to the following conditions: | |
* | |
* The above copyright notice and this permission notice shall be included in | |
* all copies or substantial portions of the Software. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | |
* DEALINGS IN THE SOFTWARE. | |
* ============================================================================ | |
* | |
* | |
* This script is an editor extension which allows GitBash to be easily | |
* launched via a keyboard shortcut and a menu item. | |
* | |
* Created by Eric Phillips on August 21, 2017. | |
*/ | |
using UnityEditor; | |
using UnityEngine; | |
using System.Diagnostics; | |
public class GitBashLauncher : Editor | |
{ | |
[MenuItem("Tools/Launch GitBash %g")] | |
private static void LaunchGitBash() | |
{ | |
string projectPath = Application.dataPath; | |
projectPath = projectPath.Substring(0, projectPath.IndexOf("/Assets")); | |
Process git = new Process(); | |
git.StartInfo.FileName = @"C:\Program Files\Git\git-bash.exe"; | |
git.StartInfo.Arguments = "--cd=\"" + projectPath + "\""; | |
git.Start(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment