Merge pull request #9 from Gnouc/master
Allow directory with trailing and leading spaces
This commit is contained in:
commit
a38e918d4a
2 changed files with 3 additions and 9 deletions
|
@ -537,11 +537,7 @@ sub process_options {
|
||||||
sub sanitize_path_options {
|
sub sanitize_path_options {
|
||||||
my ($options) = @_;
|
my ($options) = @_;
|
||||||
|
|
||||||
if (exists $options->{dir}) {
|
unless (exists $options->{dir}) {
|
||||||
$options->{dir} =~ s/\A +//;
|
|
||||||
$options->{dir} =~ s/ +\z//;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$options->{dir} = length $ENV{STOW_DIR} ? $ENV{STOW_DIR} : getcwd();
|
$options->{dir} = length $ENV{STOW_DIR} ? $ENV{STOW_DIR} : getcwd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -549,8 +545,6 @@ sub sanitize_path_options {
|
||||||
unless -d $options->{dir};
|
unless -d $options->{dir};
|
||||||
|
|
||||||
if (exists $options->{target}) {
|
if (exists $options->{target}) {
|
||||||
$options->{target} =~ s/\A +//;
|
|
||||||
$options->{target} =~ s/ +\z//;
|
|
||||||
usage("--target value '$options->{target}' is not a valid directory")
|
usage("--target value '$options->{target}' is not a valid directory")
|
||||||
unless -d $options->{target};
|
unless -d $options->{target};
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,8 +17,8 @@ init_test_dirs();
|
||||||
|
|
||||||
local @ARGV = (
|
local @ARGV = (
|
||||||
'-v',
|
'-v',
|
||||||
"-d $OUT_DIR/stow",
|
'-d', "$OUT_DIR/stow",
|
||||||
"-t $OUT_DIR/target",
|
'-t', "$OUT_DIR/target",
|
||||||
'dummy'
|
'dummy'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue