aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ManaTools/Shared/disk_backend/Mountable.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ManaTools/Shared/disk_backend/Mountable.pm')
-rw-r--r--lib/ManaTools/Shared/disk_backend/Mountable.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/ManaTools/Shared/disk_backend/Mountable.pm b/lib/ManaTools/Shared/disk_backend/Mountable.pm
index abe8404d..33cb1463 100644
--- a/lib/ManaTools/Shared/disk_backend/Mountable.pm
+++ b/lib/ManaTools/Shared/disk_backend/Mountable.pm
@@ -61,4 +61,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
use Moose::Role;
+#=============================================================
+
+=head2 find_path
+
+=head3 DESCRIPTION
+
+ this method finds in descendants the Mount part and gets the path from it
+
+=cut
+
+#=============================================================
+sub find_path {
+ my $self = shift;
+ my $partstate = shift;
+ # finding a path only works if one has a Mount or Mountable child,
+ my @children = $self->children($partstate);
+ for my $child (@children) {
+ return $child->path() if ($child->isa('ManaTools::Shared::disk_backend::Part::Mount'));
+ return $child->find_path($partstate) if ($child->does('ManaTools::Shared::disk_backend::Mountable'));
+ }
+ return undef;
+}
+
1;