diff options
author | Hans Wennborg <hans@hanshq.net> | 2013-12-02 17:31:52 +0000 |
---|---|---|
committer | Hans Wennborg <hans@hanshq.net> | 2013-12-02 17:31:52 +0000 |
commit | 86560363fdac6b4baebf68f10b7460d608b73d74 (patch) | |
tree | da32d6989a3725e3f1ea8f9acf748777c5d6755a /clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs | |
parent | 4b8d9e303c2dd63542e327d49ddcdb53b8dca25b (diff) | |
download | bcm5719-llvm-86560363fdac6b4baebf68f10b7460d608b73d74.tar.gz bcm5719-llvm-86560363fdac6b4baebf68f10b7460d608b73d74.zip |
clang-format vs plugin: bake clang-format.exe into the vsix
This makes the clang-format plugin self-contained. Instead of
requiring clang-format.exe to be available on the PATH, this
includes it in the plugin's installer (.vsix file) and runs it
from the install directory.
Differential Revision: http://llvm-reviews.chandlerc.com/D2281
llvm-svn: 196122
Diffstat (limited to 'clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs')
-rw-r--r-- | clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs b/clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs index 797d4678857..492e4f2b38f 100644 --- a/clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs +++ b/clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs @@ -22,6 +22,7 @@ using System; using System.ComponentModel;
using System.ComponentModel.Design;
using System.IO;
+using System.Reflection;
using System.Runtime.InteropServices;
using System.Xml.Linq;
@@ -128,9 +129,12 @@ namespace LLVM.ClangFormat /// </summary>
private string RunClangFormat(string text, int offset, int length, string path)
{
+ string vsixPath = Path.GetDirectoryName(Uri.UnescapeDataString(
+ new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path));
+
System.Diagnostics.Process process = new System.Diagnostics.Process();
process.StartInfo.UseShellExecute = false;
- process.StartInfo.FileName = "clang-format.exe";
+ process.StartInfo.FileName = vsixPath + "\\clang-format.exe";
// Poor man's escaping - this will not work when quotes are already escaped
// in the input (but we don't need more).
string style = GetStyle().Replace("\"", "\\\"");
|