From 07ff83f2c92cd780dc18cb29e84aec114956f185 Mon Sep 17 00:00:00 2001 From: ekatek Date: Mon, 8 Dec 2014 18:37:49 -0800 Subject: [PATCH] rename Console.directory to Console.path, do not escape spaces Rename Console.directory to Console.path. Do not attempt to automatically escape spaces in file paths -- it is hard to define a function that does this only sometimes, rather than all the time. This is something that we could change later, once we have a better idea of when we use it. --- tools/commands-cordova.js | 2 +- tools/console.js | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/tools/commands-cordova.js b/tools/commands-cordova.js index d91ccfebf2..f14653a9fc 100644 --- a/tools/commands-cordova.js +++ b/tools/commands-cordova.js @@ -1899,7 +1899,7 @@ _.extend(IOS.prototype, { "Moreover, some Cordova plugins are incompatible with this SDK.", "You can remove it by deleting this directory: "); Console.warn( - Console.directory(self.getDirectoryForSdk(version)), + Console.path(self.getDirectoryForSdk(version)), Console.options({ indent: 4 })); // Not really a failure; just warn... } diff --git a/tools/console.js b/tools/console.js index 7b996f1b15..1a2191de4c 100644 --- a/tools/console.js +++ b/tools/console.js @@ -939,13 +939,11 @@ _.extend(Console.prototype, { return self.underline(unspaced); }, - directory: function (message) { + // Format a filepath to not wrap. This does NOT automatically escape spaces + // (ie: add a slash in front so the user could copy paste the file path into a + // terminal). + path: function (message) { var self = this; - // Escape any spaces that we don't already escape. - var escapedSpace = "\\ "; - message = _.map(message.split(escapedSpace), function (msg) { - return replaceAll(msg, ' ', escapedSpace); - }).join(escapedSpace); // Make sure that we don't wrap this. var unwrapped = self.noWrap(message); return self.bold(unwrapped);