From b35c242c2ca6bde1632fe13a22664ac9f2d532bf Mon Sep 17 00:00:00 2001 From: Jonathan Lipps Date: Thu, 26 Sep 2013 12:49:56 +0100 Subject: [PATCH] don't hardcode xcode dir in getBuiltInAppDir (fix #1216) --- app/helpers.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/app/helpers.js b/app/helpers.js index d5d26748d..dc68429c4 100644 --- a/app/helpers.js +++ b/app/helpers.js @@ -158,17 +158,21 @@ exports.checkPreferencesApp = function(version, cb) { }; exports.getBuiltInAppDir = function(version, cb) { - var appDir = "/Applications/Xcode.app/Contents/Developer/Platforms" + - "/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator" + - version + ".sdk/Applications/"; - fs.stat(appDir, function(err, s) { - if (err) { - cb(err); - } else if (!s.isDirectory()) { - cb("Could not load built in applications directory"); - } else { - cb(null, appDir); - } + exports.getXcodeFolder(function(err, xcodeDir) { + if (err) return cb(err); + + var appDir = path.resolve(xcodeDir, "Platforms/iPhoneSimulator.platform/" + + "Developer/SDKs/iPhoneSimulator" + version + + ".sdk/Applications/"); + fs.stat(appDir, function(err, s) { + if (err) { + cb(err); + } else if (!s.isDirectory()) { + cb("Could not load built in applications directory"); + } else { + cb(null, appDir); + } + }); }); };