Changeset 8682


Ignore:
Timestamp:
2004-11-26T10:49:29+13:00 (19 years ago)
Author:
mdewsnip
Message:

Added a filename_head function that returns the path of a file without the filename -- ie. the directory the file is in.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/util.pm

    r7929 r8682  
    512512}
    513513
     514
     515# returns the path of a file without the filename -- ie. the directory the file is in
     516sub filename_head {
     517    my $filename = shift(@_);
     518
     519    if ($ENV{'GSDLOS'} =~ /^windows$/i) {
     520    $filename =~ s/[^\\\\]*$//;
     521    }
     522    else {
     523    $filename =~ s/[^\\\/]*$//;
     524    }
     525
     526    return $filename;
     527}
     528
     529
    514530# returns 1 if filename1 and filename2 point to the same
    515531# file or directory
Note: See TracChangeset for help on using the changeset viewer.