move the actual doing stuff code for FS lib into a Guts.pm
[scpubgit/DKit.git] / lib / DX / Lib / FS.pm
index c2be166..4b391ad 100644 (file)
@@ -219,6 +219,24 @@ sub load_into {
         +(DirPath => [ value => $dir_path ], FileName => [ value => $file ])
       }
   );
+  $solver->add_predicate(
+    path_on => [ qw(On Path FullPath) ],
+      [ qw(+ + -) ] => sub {
+        (my $path = $_{Path}) =~ s/^(:!\/)/.\//;
+        if ($_{On} eq '' or $_{On} eq 'localhost') {
+          (FullPath => [ value => $path ])
+        } else {
+          (FullPath => [ value => join(':', $_{On}, $path) ])
+        }
+      },
+      [ qw(- - +) ] => sub {
+        if (my ($on, $path) = $_{FullPath} =~ /^([^\/]+):(.*)$/) {
+          (On => [ value => $on ], Path => [ value => $path ]);
+        } else {
+          (On => [ value => 'localhost' ], Path => [ value => $_{FullPath} ]);
+        }
+      }
+  );
   $solver->add_rule(
     does => [ qw(Thing RoleName) ],
       [ constrain => [ qw(Thing RoleName) ], sub { $_[0]->DOES($_[1]) } ]