From 4097639ab7f2dd9848d566db844175c8ff3e1d2e Mon Sep 17 00:00:00 2001 From: anseki Date: Fri, 24 Apr 2015 20:00:33 +0900 Subject: [PATCH] Fix: `questionPath` does not check "~" --- README.md | 1 + lib/readline-sync.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 429af30..195947b 100644 --- a/README.md +++ b/README.md @@ -800,6 +800,7 @@ console.log('-- saveDir: ' + saveDir); ```console Read from :~/fileA No such file or directory: /home/user/fileA +Input valid path, please. Read from :pwd /path/to/work Read from :cd ~/project-1 diff --git a/lib/readline-sync.js b/lib/readline-sync.js index 4e1de64..6604c2d 100644 --- a/lib/readline-sync.js +++ b/lib/readline-sync.js @@ -944,7 +944,7 @@ exports.questionPath = function(query, options) { keepWhitespace: false, limit: function(value) { var exists, stat, res; - value = replaceHomePath(value); + value = replaceHomePath(value, true); // mkdir -p function mkdirParents(dirPath) { dirPath.split(/\/|\\/).reduce(function(parents, dir) {