Subject: | sub change_dir possibly broken |
It looks like the last line in sub change_dir is stripping the
configured root_dir off of the path and actually changing to a directory
relative to root '/'. The 05cd.t seems to confirm this.
$model->cd('sub', 'dir');
is(Path::Class::dir('/sub/dir'), $model->pwd, "pwd is correct");
This passes even though the model should (if i'm understanding it right)
have changed to a directory within $ENV{MODEL_FILE_DIR}.
The line of code that seems to be causing this in File.pm is:
$self->{directory} =
$self->{_dir}->relative($self->{root_dir})->absolute('/');
It looks like changing it to the line below would fix things.
$self->{directory} =
$self->{_dir}->relative($self->{root_dir})->absolute();
Here is what I used to test that assertion:
--(0)> perl -MPath::Class::Dir -e 'print Path::Class::Dir->new("var",
"files")->subdir("sub")->subdir("dir")->relative("var/files")->absolute("/"),
"\n"'
/sub/dir
--(joshua@joshua-mcadams-powerbook-g4-12)-(~/Development/files/Files/lib/Catalyst/Model)--
--(0)> perl -MPath::Class::Dir -e 'print Path::Class::Dir->new("var",
"files")->subdir("sub")->subdir("dir")->relative("var/files")->absolute(),
"\n"'
/Users/joshua/Development/files/Files/lib/Catalyst/Model/sub/dir