Skip to content

Commit

Permalink
Merge pull request #64 from appcelerator/timob-15714
Browse files Browse the repository at this point in the history
[TIMOB-15714] Fixed bug with Titanium module zip files not being extracted.
  • Loading branch information
ayeung committed Nov 15, 2013
2 parents 7dbc4a1 + 539e623 commit eba9f35
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/timodule.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,20 +277,20 @@ function detectModules(searchPaths, config, logger, callback) {

Array.isArray(searchPaths) || (searchPaths = [searchPaths]);

async.parallel(searchPaths.map(function (root) {
async.parallel(searchPaths.map(function (modulesDir) {
return function(cb) {
if (!fs.existsSync(root)) return cb();
if (!fs.existsSync(modulesDir)) return cb();

var moduleRoot = root,
var moduleRoot = path.join(modulesDir, '..'),
tasks = [];

// auto-install zipped modules
fs.readdirSync(root).forEach(function (file) {
var moduleZip = path.join(root, file);
fs.readdirSync(moduleRoot).forEach(function (file) {
var moduleZip = path.join(moduleRoot, file);
if (fs.existsSync(moduleZip) && fs.statSync(moduleZip).isFile() && zipRegExp.test(file)) {
tasks.push(function (taskDone) {
logger && logger.info(__('Installing module: %s', file));
zip.unzip(moduleZip, root, null, function (err) {
zip.unzip(moduleZip, moduleRoot, null, function (err) {
if (err) {
logger && logger.error(__('Failed to unzip module "%s"', moduleZip));
} else {
Expand All @@ -303,13 +303,13 @@ function detectModules(searchPaths, config, logger, callback) {
});

async.parallel(tasks, function () {
if (!fs.existsSync(moduleRoot)) return cb();
if (!fs.existsSync(modulesDir)) return cb();

logger && logger.debug(__('Detecting modules in %s', moduleRoot.cyan));
logger && logger.debug(__('Detecting modules in %s', modulesDir.cyan));

// loop through platforms
fs.readdirSync(moduleRoot).forEach(function (platform) {
var modulesPath = path.join(moduleRoot, platform);
fs.readdirSync(modulesDir).forEach(function (platform) {
var modulesPath = path.join(modulesDir, platform);
if (fs.existsSync(modulesPath) && fs.statSync(modulesPath).isDirectory() && !osNamesRegExp.test(platform) && !ignoreDirs.test(platform)) {
// loop through module names
fs.readdirSync(modulesPath).forEach(function (moduleName) {
Expand Down

0 comments on commit eba9f35

Please sign in to comment.