mirror of
https://github.com/appium/appium.git
synced 2026-02-11 20:39:04 -06:00
fix tracetemplate detection logic and logging (fix #1386)
This commit is contained in:
@@ -321,23 +321,29 @@ IOS.prototype.setXcodeVersion = function(cb) {
|
||||
};
|
||||
|
||||
IOS.prototype.detectTraceTemplate = function(cb) {
|
||||
if (this.automationTraceTemplatePath === null) {
|
||||
helpers.getXcodeFolder(function(res, xcodeFolderPath) {
|
||||
var msg;
|
||||
if (!this.automationTraceTemplatePath) {
|
||||
helpers.getXcodeFolder(function(err, xcodeFolderPath) {
|
||||
if (err) return cb(err);
|
||||
if (xcodeFolderPath !== null) {
|
||||
var xcodeTraceTemplatePath = path.resolve(xcodeFolderPath,
|
||||
"../Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.bundle/Contents/Resources/" +
|
||||
"../Applications/Instruments.app/Contents/PlugIns",
|
||||
"AutomationInstrument.bundle/Contents/Resources",
|
||||
"Automation.tracetemplate");
|
||||
if (fs.existsSync(xcodeTraceTemplatePath)) {
|
||||
this.automationTraceTemplatePath = xcodeTraceTemplatePath;
|
||||
cb();
|
||||
} else {
|
||||
logger.error("Could not find Automation.tracetemplate in " + xcodeTraceTemplatePath);
|
||||
cb(new Error("Could not find Automation.tracetemplate in " + xcodeTraceTemplatePath));
|
||||
msg = "Could not find Automation.tracetemplate in " +
|
||||
xcodeTraceTemplatePath;
|
||||
logger.error(msg);
|
||||
cb(new Error(msg));
|
||||
}
|
||||
} else {
|
||||
logger.error("Could not find Automation.tracetemplate because XCode could not be found. " +
|
||||
"Try setting the path with xcode-select.");
|
||||
cb(new Error("Could not find Automation.tracetemplate because XCode could not be found."));
|
||||
msg = "Could not find Automation.tracetemplate because XCode " +
|
||||
"could not be found. Try setting the path with xcode-select.";
|
||||
logger.error(msg);
|
||||
cb(new Error(msg));
|
||||
}
|
||||
}.bind(this));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user