Fix: questionPath does not check "~"

This commit is contained in:
anseki 2015-04-24 20:00:33 +09:00
parent 0c9ee33072
commit 4097639ab7
2 changed files with 2 additions and 1 deletions

View file

@ -800,6 +800,7 @@ console.log('-- saveDir: ' + saveDir);
```console ```console
Read from :~/fileA Read from :~/fileA
No such file or directory: /home/user/fileA No such file or directory: /home/user/fileA
Input valid path, please.
Read from :pwd Read from :pwd
/path/to/work /path/to/work
Read from :cd ~/project-1 Read from :cd ~/project-1

View file

@ -944,7 +944,7 @@ exports.questionPath = function(query, options) {
keepWhitespace: false, keepWhitespace: false,
limit: function(value) { limit: function(value) {
var exists, stat, res; var exists, stat, res;
value = replaceHomePath(value); value = replaceHomePath(value, true);
// mkdir -p // mkdir -p
function mkdirParents(dirPath) { function mkdirParents(dirPath) {
dirPath.split(/\/|\\/).reduce(function(parents, dir) { dirPath.split(/\/|\\/).reduce(function(parents, dir) {