summaryrefslogtreecommitdiff
path: root/lib/AniDB/Manager.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/AniDB/Manager.pm')
-rw-r--r--lib/AniDB/Manager.pm7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/AniDB/Manager.pm b/lib/AniDB/Manager.pm
index 21d0d82..ee9d48e 100644
--- a/lib/AniDB/Manager.pm
+++ b/lib/AniDB/Manager.pm
@@ -66,10 +66,13 @@ sub maybe_new_name_for($self,$path) {
return $new_name;
}
-sub rename($self,$path,$new_path) {
+sub rename($self,$path,$new_path = undef) {
$path = path($path)->realpath;
$new_path ||= $self->new_name_for($path);
- if ($path->move($new_path)) {
+ if (
+ $new_path->parent->mkpath
+ && $path->move($new_path)
+ ) {
$self->datastore->rename($path,$new_path);
return 1;
}