]> granicus.if.org Git - clang/commitdiff
Add a check for a running Xcode before modifying its configuration files.
authorTed Kremenek <kremenek@apple.com>
Tue, 9 Feb 2010 18:46:58 +0000 (18:46 +0000)
committerTed Kremenek <kremenek@apple.com>
Tue, 9 Feb 2010 18:46:58 +0000 (18:46 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95675 91177308-0d34-0410-b5e6-96231b3b80d8

tools/scan-build/set-xcode-analyzer

index cf0ba3a1af06716058244b71c83f3881292ed448..5f7551b7cb8c2ffca7fcf844776c578289704d19 100755 (executable)
@@ -6,6 +6,7 @@ import re
 import tempfile
 import shutil
 import stat
+from AppKit import *
 
 def FindClangSpecs(path):
   for root, dirs, files in os.walk(path):
@@ -50,6 +51,12 @@ def main():
   if options.path is None and options.default is None:
     parser.error("You must specify a version of Clang to use for static analysis.  Specify '-h' for details")
 
+  # determine if Xcode is running
+  for x in NSWorkspace.sharedWorkspace().runningApplications():
+    if x.localizedName().find("Xcode") >= 0:
+      print "You must quit Xcode first before modifying its configuration files."
+      return
+
   if options.path:
     # Expand tildes.
     path = os.path.expanduser(options.path)
@@ -61,8 +68,8 @@ def main():
   else:
     print "Using the Clang bundled with Xcode"
     path = options.default
-
   print ""
+  
   for x in FindClangSpecs('/Developer'):
     ModifySpec(x, path)