Skip to content
This repository has been archived by the owner on Oct 4, 2019. It is now read-only.

Revert "Feature/appcode3 xcodepath" #48

Merged
merged 1 commit into from
Oct 24, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions Scripts/dyci-recompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,13 @@ def copyResource(source, dyci):
os.chdir(workingDir)
params = params[:-1]

if len(args)>1:
xcodeLocation = args[2]
else:
# Searching where is Xcode with it's Clang located
process = Popen(["xcode-select","-print-path"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
xcodeLocation, err = process.communicate()
xcodeLocation = xcodeLocation.rstrip(os.linesep)

# Searching where is Xcode with it's Clang located
process = Popen(["xcode-select","-print-path"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
xcodeLocation, err = process.communicate()
xcodeLocation = xcodeLocation.rstrip(os.linesep)

compileString = [xcodeLocation + '/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang-real'] \
+ params
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,9 @@

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;

import javax.xml.xpath.*;
import org.xml.sax.InputSource;

/**
* Created with IntelliJ IDEA.
* User: paultaykalo
Expand Down Expand Up @@ -52,24 +48,6 @@ public void actionPerformed(final AnActionEvent actionEvent) {
this.injectFile(actionEvent, path);


}

private String xcodePath(java.io.FileReader fileReader){
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(fileReader);
String result = expr.evaluate(inputSource);
return result;

} catch(Exception e){
LOG.error("Exception getting Xcode path: " + e.getMessage());
this.showMessageBubble(actionEvent, MessageType.ERROR, "Failed to run injection script");
}

}

private void injectFile(final AnActionEvent actionEvent, final String path) {
Expand All @@ -91,21 +69,9 @@ private void injectFile(final AnActionEvent actionEvent, final String path) {
this.showMessageBubble(actionEvent, MessageType.ERROR, "Cannot run injection. No Dyci scripts were found. Make sure, that you've ran install.sh");
return;
}

String appcodeOptionsFilename = System.getProperty("user.home") + "/Library/Preferences/appCode30/options/other.xml";

String[] commands;
try {
FileReader appcodeOptions = new FileReader(appcodeOptionsFilename);
String xcodePath = xcodePath(appcodeOptions);
commands = new String[] {dyciScriptLocation, path, xcodePath};
} catch(IOException e) {
// If the file cannot be found, it might not be a problem (user has appcode 2 or maybe the setting wasn't saved)
// We'll just leave it up to the dyci script to find Xcode.
commands = new String[] {dyciScriptLocation, path};
}

Runtime rt = Runtime.getRuntime();
String[] commands = {dyciScriptLocation, path};
try {
Process proc = rt.exec(commands);

Expand Down