Commit d42819d3 authored by Karl Kornel's avatar Karl Kornel
Browse files

Add folder_name function, to return the last component of a path

parent b5c5912a
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ use strict;
use warnings;

use Cwd;
use File::Basename;


# This is a support script, which is loaded by the various "bbox-workflow"
@@ -84,5 +85,14 @@ sub directory_rename {
}


# folder_name: Given a path, get the name of the last component.
# $path: The path.
sub folder_name {
    my ($path) = @_;
    $path = Cwd::abs_path($path);
    return File::Basename::basename($path);
}


# End on a true value.
1;