Last active
August 29, 2015 14:08
-
-
Save grav/d8f44d1a2ad527e764dc to your computer and use it in GitHub Desktop.
Get Xcode path from AppCode settings
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
import javax.xml.xpath.*; | |
import org.xml.sax.InputSource; | |
public class XcodePath { | |
public static void main(String[] args){ | |
String appcodeOptions = System.getProperty("user.home") + "/Library/Preferences/appCode30/options/other.xml"; | |
String xpathExpression = "/application/component[@name='XcodeSettings']/option[@name='selectedXcode']/@value"; | |
XPathFactory xpathFactory = XPathFactory.newInstance(); | |
XPath xpath = xpathFactory.newXPath(); | |
try{ | |
XPathExpression expr = xpath.compile(xpathExpression); | |
InputSource inputSource = new InputSource(new java.io.FileReader(appcodeOptions)); | |
String result = expr.evaluate(inputSource); | |
System.out.println(result); | |
} catch(Exception e){ | |
System.out.println(e); | |
} | |
} | |
} |
Author
grav
commented
Oct 23, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment