Skip to content

Commit

Permalink
Implement IO::Spec.dirname (instead of .directory)
Browse files Browse the repository at this point in the history
.directory will still work, but is deprecated
  • Loading branch information
lizmat committed Sep 29, 2014
1 parent a6af28f commit 4191d07
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/core/IO/Path.pm
Expand Up @@ -37,8 +37,12 @@ my class IO::Path is Cool does IO::FileTestable {
method basename(IO::Path:D:) {
self.parts<basename>
}
method dirname(IO::Path:D:) {
self.parts<dirname>
}
method directory(IO::Path:D:) {
self.parts<directory>
DEPRECATED("dirname");
self.parts<dirname>
}
method volume(IO::Path:D:) {
self.parts<volume>
Expand Down
4 changes: 3 additions & 1 deletion src/core/IO/Spec/Unix.pm
Expand Up @@ -71,7 +71,9 @@ my class IO::Spec::Unix is IO::Spec {
$dirname = '.' if $dirname eq '' && $basename ne '';
# shell dirname '' produces '.', but we don't because it's probably user error

return (:volume(''), :$dirname, :$basename );
# temporary, for the transition period
(:volume(''), :$dirname, :$basename, :directory($dirname));
# (:volume(''), :$dirname, :$basename);
}


Expand Down
4 changes: 3 additions & 1 deletion src/core/IO/Spec/Win32.pm
Expand Up @@ -67,7 +67,9 @@ my class IO::Spec::Win32 is IO::Spec::Unix {
$basename = '\\' if $dirname eq any('/', '\\') && $basename eq '';
$dirname = '.' if $dirname eq '' && $basename ne '';

return (:$volume, :$dirname, :$basename);
# temporary, for the transition period
(:$volume, :$dirname, :$basename, :directory($dirname));
# (:$volume, :$dirname, :$basename);
}

method join ($volume, $dirname is copy, $file is copy) {
Expand Down

0 comments on commit 4191d07

Please sign in to comment.