use mkbasepath more
authorDobrica Pavlinusic <dpavlin@rsync1.maxxo.com>
Tue, 6 Dec 2011 14:35:28 +0000 (15:35 +0100)
committerDobrica Pavlinusic <dpavlin@rsync1.maxxo.com>
Tue, 6 Dec 2011 14:38:21 +0000 (15:38 +0100)
lib/CloudStore/Store.pm

index 9ae48ac..dea4d0c 100644 (file)
@@ -192,9 +192,7 @@ sub new_link {
                        });
 
                        # $name can contain directories so we must create them
-                       my $to_dir = $d;
-                       $to_dir =~ s{/[^/]+$}{};
-                       make_path $to_dir if ! -e $to_dir;
+                       mkbasedir $d;
 
                        if ( ! -e $s ) {
                                warn "ERROR: can't find source $s";
@@ -276,7 +274,6 @@ sub rsync_log {
 
                delete $self->{pid}->{$pid};
                warn "removed $pid";
-warn dump $self;
 
        } else {
 #              warn "## rsync_log $data";
@@ -366,8 +363,7 @@ sub dedup {
                        my $new_path = $self->blob_path($new);
                        if ( ! -e $new_path ) {
                                # create path from md5sum file
-                               my $only_dir = $1 if $new =~ m{^(.+)/[^/]+$};
-                               make_path $only_dir unless -d $only_dir;
+                               mkbasedir $new_path;
                                $imported += link "$self->{md5path}/$md5", $new_path;
                                $self->new_file($new);
                                warn "import from $path ",dump($new);