Make error text if clang-format is not on the system PATH more helpful,
authorManuel Klimek <klimek@google.com>
Thu, 5 Sep 2013 08:31:48 +0000 (08:31 +0000)
committerManuel Klimek <klimek@google.com>
Thu, 5 Sep 2013 08:31:48 +0000 (08:31 +0000)
as this is going to be a common mistake (installing LLVM defaults to not putting
the tools onto the PATH).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@190036 91177308-0d34-0410-b5e6-96231b3b80d8

tools/clang-format-vs/ClangFormat/ClangFormatPackage.cs

index 61cc6447c0d0114ed740da00ddc8495f38b40392..c216030b9d76b18fa7b8b8e972aa3616d2ddbbe0 100644 (file)
@@ -148,7 +148,16 @@ namespace LLVM.ClangFormat
             // Thus, we:\r
             // 1. Start the process - clang-format.exe will start to read the input from the\r
             //    standard input.\r
-            process.Start();\r
+            try\r
+            {\r
+                process.Start();\r
+            }\r
+            catch (Exception e)\r
+            {\r
+                throw new Exception(\r
+                    "Cannot execute " + process.StartInfo.FileName + ".\n\"" + \r
+                    e.Message + "\".\nPlease make sure it is on the PATH.");\r
+            }\r
             // 2. We write everything to the standard output - this cannot block, as clang-format\r
             //    reads the full standard input before analyzing it without writing anything to the\r
             //    standard output.\r