Merge pull request #9 from Gnouc/master

Allow directory with trailing and leading spaces
This commit is contained in:
Adam Spiers 2015-11-13 14:50:19 +00:00
commit a38e918d4a
2 changed files with 3 additions and 9 deletions

View file

@ -537,11 +537,7 @@ sub process_options {
sub sanitize_path_options {
my ($options) = @_;
if (exists $options->{dir}) {
$options->{dir} =~ s/\A +//;
$options->{dir} =~ s/ +\z//;
}
else {
unless (exists $options->{dir}) {
$options->{dir} = length $ENV{STOW_DIR} ? $ENV{STOW_DIR} : getcwd();
}
@ -549,8 +545,6 @@ sub sanitize_path_options {
unless -d $options->{dir};
if (exists $options->{target}) {
$options->{target} =~ s/\A +//;
$options->{target} =~ s/ +\z//;
usage("--target value '$options->{target}' is not a valid directory")
unless -d $options->{target};
}

View file

@ -17,8 +17,8 @@ init_test_dirs();
local @ARGV = (
'-v',
"-d $OUT_DIR/stow",
"-t $OUT_DIR/target",
'-d', "$OUT_DIR/stow",
'-t', "$OUT_DIR/target",
'dummy'
);