Skip to content

Commit

Permalink
[TIMOB-25028] Remove duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
ewanharris committed Jul 26, 2017
1 parent 6edb7d7 commit 63f7101
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions build/packager.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,30 +258,25 @@ Packager.prototype.package = function (next) {
// Now include all the pre-built node-ios-device bindings/binaries
function (cb) {
if (this.targetOS === 'osx') {
console.log(path.join(this.zipSDKDir, 'node_modules', 'node-ios-device'));
const hoistedPath = path.join(this.zipSDKDir, 'node_modules', 'node-ios-device');
const normalPath = path.join(this.zipSDKDir, 'node_modules', 'ioslib', 'node_modules', 'node-ios-device');
if (fs.existsSync(hoistedPath)) {
exec('node bin/download-all.js', {cwd: hoistedPath}, function (err, stdout, stderr) {
if (err) {
console.log(stdout);
console.error(stderr);
return cb(err);
}
cb();
});
} else if (fs.existsSync(normalPath)) {
exec('node bin/download-all.js', {cwd: normalPath}, function (err, stdout, stderr) {
if (err) {
console.log(stdout);
console.error(stderr);
return cb(err);
}
cb();
});
} else {
return cb(new Error('Unable to find node-ios-device module'))
var dir = path.join(this.zipSDKDir, 'node_modules', 'node-ios-device');

if (!fs.existsSync(dir)) {
dir = path.join(this.zipSDKDir, 'node_modules', 'ioslib', 'node_modules', 'node-ios-device');
}

if (!fs.existsSync(dir)) {
return cb(new Error('Unable to find node-ios-device module'));
}

exec('node bin/download-all.js', {cwd: dir}, function (err, stdout, stderr) {
if (err) {
console.log(stdout);
console.error(stderr);
return cb(err);
}
cb();
});

} else {
cb();
}
Expand Down

0 comments on commit 63f7101

Please sign in to comment.