Skip to content

Commit

Permalink
fixing getNetworkIp() returning undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelluchini committed Nov 21, 2014
1 parent 44b4af5 commit 6e7dd2e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions lib/samsungpackager.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,18 @@ var Q = require('q');
var archiver = require('archiver');

var getNetworkIp = function(){
var ifaces = os.networkInterfaces();
var interfaces = os.networkInterfaces();
var out = null;
ifaces.en0.forEach(function(details){
if (details.family=='IPv4') {
out = details.address;
var each = function(intface){
if ( intface.family === "IPv4" && !intface.internal ) {
out = intface.address;
}
};
for ( var i in interfaces ) {
if ( interfaces.hasOwnProperty( i ) ) {
interfaces[i].map(each);
}
});
}
return out;
};

Expand Down Expand Up @@ -126,6 +131,6 @@ exports.run = function(folderToArchive, serverFolder, appID, appTitle, port){
startServer(_serverFolder, _port);
deferred.resolve();
});
})
});
return deferred.promise;
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "samsungstv-packager",
"version": "0.0.4",
"version": "0.0.5",
"description": "Helps you package HTML5 Apps for Samsung Smart TV without touching their SDK.",
"author": "Raphael Luchini",
"dependencies": {
Expand Down

0 comments on commit 6e7dd2e

Please sign in to comment.