Return-Path: X-Original-To: apmail-cordova-dev-archive@www.apache.org Delivered-To: apmail-cordova-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 442A01892B for ; Wed, 8 Jul 2015 16:09:28 +0000 (UTC) Received: (qmail 88855 invoked by uid 500); 8 Jul 2015 16:09:28 -0000 Delivered-To: apmail-cordova-dev-archive@cordova.apache.org Received: (qmail 88812 invoked by uid 500); 8 Jul 2015 16:09:28 -0000 Mailing-List: contact dev-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list dev@cordova.apache.org Received: (qmail 88800 invoked by uid 99); 8 Jul 2015 16:09:27 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 08 Jul 2015 16:09:27 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A127FDFD63; Wed, 8 Jul 2015 16:09:27 +0000 (UTC) From: robpaveza To: dev@cordova.apache.org Reply-To: dev@cordova.apache.org References: In-Reply-To: Subject: [GitHub] cordova-windows pull request: CB-9283: Add support for Windows 10 ... Content-Type: text/plain Message-Id: <20150708160927.A127FDFD63@git1-us-west.apache.org> Date: Wed, 8 Jul 2015 16:09:27 +0000 (UTC) Github user robpaveza commented on a diff in the pull request: https://github.com/apache/cordova-windows/pull/96#discussion_r34166300 --- Diff: template/cordova/lib/package.js --- @@ -113,16 +112,32 @@ function getPackageName(platformPath) { // returns one of available devices which name match with provided string // return rejected promise if device with name specified not found -module.exports.findDevice = function (target) { +module.exports.findDevice = function (deploymentTool, target) { target = target.toLowerCase(); - return module.exports.listDevices().then(function(deviceList) { + return deploymentTool.enumerateDevices().then(function(deviceList) { // CB-7617 since we use partial match shorter names should go first, // example case is ['Emulator 8.1 WVGA 4 inch 512MB', 'Emulator 8.1 WVGA 4 inch'] - var sortedList = deviceList.concat().sort(function (l, r) { return l.length > r.length; }); - for (var idx in sortedList){ - if (sortedList[idx].toLowerCase().indexOf(target) > -1) { - // we should return index based on original list - return Q.resolve(deviceList.indexOf(sortedList[idx])); + // In CB-9283, we need to differentiate between emulator, device, and target. + // So, for emulators to honor the above CB-7617, we preserve the original behavior. + // Else, we choose either the target by ID (DeviceInfo.index) or if it's just device, + // we choose the default (aka first) device. + if (target === 'emulator') { + var sortedList = deviceList.concat().sort(function (l, r) { return l.toString().length > r.toString().length; }); + for (var idx in sortedList){ --- End diff -- Yeah.... I didn't want to mess with this code and end up breaking something downstream. It seems to have been working for us up until now. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@cordova.apache.org For additional commands, e-mail: dev-help@cordova.apache.org