- Timestamp:
- 2012-05-11T16:40:12+12:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/util.pm
r25572 r25577 206 206 # now all content is moved across, delete empty dir in source folder 207 207 if(&is_dir_empty($file)) { 208 &rm_r($file); 208 if (!rmdir $file) { 209 print STDERR "util::mv_dir_contents couldn't remove directory $file\n"; 210 } 209 211 } else { # error 210 212 print STDERR "ERROR. util::mv_dir_contents: subfolder $file still non-empty after moving contents to $dest_dir\n"; … … 1779 1781 1780 1782 1783 # Given the qualified collection name (colgroup/collection), 1784 # returns the collection and colgroup parts 1785 sub get_collection_parts { 1786 # http://perldoc.perl.org/File/Basename.html 1787 # my($filename, $directories, $suffix) = fileparse($path); 1788 # "$directories contains everything up to and including the last directory separator in the $path 1789 # including the volume (if applicable). The remainder of the $path is the $filename." 1790 #my ($collection, $colgroup) = &File::Basename::fileparse($qualified_collection); 1791 1792 my $qualified_collection = shift(@_); 1793 1794 # Since activate.pl can be launched from the command-line, including by a user, 1795 # best not to assume colgroup uses URL-style slashes as would be the case with GLI 1796 # Also allow for the accidental inclusion of multiple slashes 1797 my ($colgroup, $collection) = split(/[\/\\]+/, $qualified_collection); #split('/', $qualified_collection); 1798 1799 if(!defined $collection) { 1800 $collection = $colgroup; 1801 $colgroup = ""; 1802 } 1803 return ($collection, $colgroup); 1804 } 1805 1806 # work out the "collectdir/collection" location 1807 sub resolve_collection_dir { 1808 my ($collect_dir, $qualified_collection, $site) = @_; #, $gs_mode 1809 1810 my ($colgroup, $collection) = &util::get_collection_parts($qualified_collection); 1811 1812 if (defined $collect_dir) { 1813 return &util::filename_cat($collect_dir,$colgroup, $collection); 1814 } 1815 else { 1816 if (defined $site) { 1817 return &util::filename_cat($ENV{'GSDL3HOME'},"sites",$site,"collect",$colgroup, $collection); 1818 } 1819 else { 1820 return &util::filename_cat($ENV{'GSDLHOME'},"collect",$colgroup, $collection); 1821 } 1822 } 1823 } 1824 1781 1825 1;
Note:
See TracChangeset
for help on using the changeset viewer.