diff options
-rw-r--r-- | clang/tools/clang-format-vs/ClangFormat/ClangFormat.csproj | 3 | ||||
-rw-r--r-- | clang/tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs | 6 | ||||
-rw-r--r-- | clang/tools/clang-format-vs/README.txt | 3 |
3 files changed, 11 insertions, 1 deletions
diff --git a/clang/tools/clang-format-vs/ClangFormat/ClangFormat.csproj b/clang/tools/clang-format-vs/ClangFormat/ClangFormat.csproj index 65ccaba0f18..2f49221d14b 100644 --- a/clang/tools/clang-format-vs/ClangFormat/ClangFormat.csproj +++ b/clang/tools/clang-format-vs/ClangFormat/ClangFormat.csproj @@ -178,6 +178,9 @@ <None Include="Resources\Images_32bit.bmp" />
</ItemGroup>
<ItemGroup>
+ <Content Include="clang-format.exe">
+ <IncludeInVSIX>true</IncludeInVSIX>
+ </Content>
<Content Include="Resources\Package.ico" />
</ItemGroup>
<ItemGroup>
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("\"", "\\\"");
diff --git a/clang/tools/clang-format-vs/README.txt b/clang/tools/clang-format-vs/README.txt index 9b75bc30657..d74060e19a4 100644 --- a/clang/tools/clang-format-vs/README.txt +++ b/clang/tools/clang-format-vs/README.txt @@ -5,3 +5,6 @@ Build prerequisites are: - Visual Studio 2012 Professional
- Visual Studio 2010 Professional
- Visual Studio 2010 SDK.
+
+clang-format.exe must be copied into the ClangFormat/ directory before building.
+It will be bundled into the .vsix file.
|