[Bps-public-commit] Prophet branch, master, updated. b82d4837605ac5c03a411bc7ec9a421fdc8c891b

sunnavy at bestpractical.com sunnavy at bestpractical.com
Tue Aug 11 22:56:50 EDT 2009


The branch, master has been updated
       via  b82d4837605ac5c03a411bc7ec9a421fdc8c891b (commit)
       via  aa78f04ab6ddcf747cd5e6b12d95c4ac29188f6a (commit)
      from  342703765fdb6e7483098bfe844e7a2f93b4719f (commit)

Summary of changes:
 lib/Prophet/Replica/prophet.pm       |    6 +++++-
 lib/Prophet/Replica/prophet_cache.pm |    8 ++++++--
 lib/Prophet/Replica/sqlite.pm        |    6 +++++-
 3 files changed, 16 insertions(+), 4 deletions(-)

- Log -----------------------------------------------------------------
commit aa78f04ab6ddcf747cd5e6b12d95c4ac29188f6a
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Aug 12 10:52:14 2009 +0800

    make fs_root and fs_root_parent happy on win

diff --git a/lib/Prophet/Replica/prophet.pm b/lib/Prophet/Replica/prophet.pm
index a017ddc..f307332 100644
--- a/lib/Prophet/Replica/prophet.pm
+++ b/lib/Prophet/Replica/prophet.pm
@@ -37,7 +37,11 @@ has fs_root_parent => (
     lazy    => 1,
     default => sub {
         my $self = shift;
-        return $self->url =~ m{^file://(.*)/.*?$} ? $1 : undef;
+        if ( $self->url =~ m{^file://(.*)} ) {
+            my $path = $1;
+            return File::Spec->catdir(
+                ( File::Spec->splitpath($path) )[ 0, -2 ] );
+        }
     },
 );
 
diff --git a/lib/Prophet/Replica/prophet_cache.pm b/lib/Prophet/Replica/prophet_cache.pm
index db94a65..5a31037 100644
--- a/lib/Prophet/Replica/prophet_cache.pm
+++ b/lib/Prophet/Replica/prophet_cache.pm
@@ -25,7 +25,9 @@ has fs_root_parent => (
     lazy    => 1,
     default => sub {
         my $self = shift;
-        return $self->fs_root =~ m{^(.*)/.+/?$} ? $1 : undef;
+        my $path = $self->fs_root;
+        return File::Spec->catdir(
+                ( File::Spec->splitpath($path) )[ 0, -2 ] );
     },
 );
 
@@ -82,7 +84,9 @@ has fs_root => (
     lazy    => 1,
     default => sub {
         my $self = shift;
-        return $self->app_handle->handle->url =~ m{^file://(.*)$} ? $1.'/remote-replica-cache/' : undef;
+        return $self->app_handle->handle->url =~ m{^file://(.*)$}
+          ? File::Spec->catdir( $1, 'remote-replica-cache' )
+          : undef;
     },
 );
 
diff --git a/lib/Prophet/Replica/sqlite.pm b/lib/Prophet/Replica/sqlite.pm
index 61972c3..660de50 100644
--- a/lib/Prophet/Replica/sqlite.pm
+++ b/lib/Prophet/Replica/sqlite.pm
@@ -60,7 +60,11 @@ has fs_root_parent => (
     lazy    => 1,
     default => sub {
         my $self = shift;
-        return $self->url =~ m{^(?:sqlite\:)?file://(.*)/.*?$} ? $1 : undef;
+        if ( $self->url =~ m{^(?:sqlite:)?file://(.*)} ) {
+            my $path = $1;
+            return File::Spec->catdir(
+                ( File::Spec->splitpath($path) )[ 0, -2 ] );
+        }
     }
 );
 

commit b82d4837605ac5c03a411bc7ec9a421fdc8c891b
Merge: aa78f04 3427037
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Wed Aug 12 10:55:13 2009 +0800

    Merge branch 'master' of code.bestpractical.com:/git/prophet


-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list