Changeset 16380
- Timestamp:
- 2008-07-14T14:35:40+12:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/util.pm
r16266 r16380 648 648 } 649 649 650 # splits a filename into a prefix and a tail extension using the tail_re, or 651 # if that fails, splits on the file_extension . (dot) 652 sub get_prefix_and_tail_by_regex { 653 654 my ($filename,$tail_re) = @_; 655 656 my ($file_prefix,$file_ext) = ($filename =~ m/^(.*?)($tail_re)$/); 657 if ((!defined $file_prefix) || (!defined $file_ext)) { 658 ($file_prefix,$file_ext) = ($filename =~ m/^(.*)(\..*?)$/); 659 } 660 661 return ($file_prefix,$file_ext); 662 } 663 664 # get full path and file only path from a base_dir (which may be empty) and 665 # file (which may contain directories) 666 sub get_full_filenames { 667 my ($base_dir, $file) = @_; 668 669 my $filename_full_path = $file; 670 # add on directory if present 671 $filename_full_path = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\S/; 672 673 my $filename_no_path = $file; 674 675 # remove directory if present 676 $filename_no_path =~ s/^.*[\/\\]//; 677 return ($filename_full_path, $filename_no_path); 678 } 650 679 651 680 # returns the path of a file without the filename -- ie. the directory the file is in
Note:
See TracChangeset
for help on using the changeset viewer.