Changeset 10281


Ignore:
Timestamp:
2005-07-25T14:21:41+12:00 (19 years ago)
Author:
chi
Message:

Add filename_within_collection().

File:
1 edited

Legend:

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

    r10212 r10281  
    596596}
    597597
     598sub filename_within_collection
     599{
     600    my ($filename) = @_;
     601
     602    my $collect_dir = $ENV{'GSDLCOLLECTDIR'};
     603   
     604    if (defined $collect_dir) {
     605    my $dirsep = &util::get_dirsep();
     606    if ($collect_dir !~ m/$dirsep$/) {
     607        $collect_dir .= $dirsep;
     608    }
     609   
     610    $collect_dir =~ s/\\/\\\\/g; # escape DOS style file separator
     611   
     612    if ($filename =~ /^$collect_dir(.*)$/) {
     613        $filename = $1;
     614    }
     615    }
     616   
     617    return $filename;
     618}
     619
     620
    598621sub get_dirsep {
    599622
Note: See TracChangeset for help on using the changeset viewer.