898 | | set pathToCategory [file join $root $category] |
899 | | if {[file isdirectory $pathToCategory]} { |
900 | | # Iterate on port directories. |
901 | | foreach port [lsort -increasing -unique [readdir $pathToCategory]] { |
902 | | set pathToPort [file join $pathToCategory $port] |
903 | | if {[file isdirectory $pathToPort] && |
904 | | [file exists [file join $pathToPort "Portfile"]]} { |
905 | | # Call the function. |
906 | | $func [file join $category $port] |
907 | | |
908 | | # Restore the current directory because some |
909 | | # functions changes it. |
910 | | cd $pathToRoot |
| 898 | # if $category is more than one character, expect to find ports in $category |
| 899 | if {[string length $category] != 1} { |
| 900 | set pathToCategory [file join $root $category] |
| 901 | if {[file isdirectory $pathToCategory]} { |
| 902 | # Iterate on port directories. |
| 903 | foreach port [lsort -increasing -unique [readdir $pathToCategory]] { |
| 904 | set pathToPort [file join $pathToCategory $port] |
| 905 | if {[file isdirectory $pathToPort] && |
| 906 | [file exists [file join $pathToPort "Portfile"]]} { |
| 907 | # Call the function. |
| 908 | $func [file join $category $port] |
| 909 | |
| 910 | # Restore the current directory because some |
| 911 | # functions changes it. |
| 912 | cd $pathToRoot |
| 913 | } |
913 | | } |
| 916 | # if $category is only one character, expect to find ports in $category/subcategory |
| 917 | } else { |
| 918 | set pathToCategory [file join $root $category] |
| 919 | if {[file isdirectory $pathToCategory]} { |
| 920 | # Iterate on port directories. |
| 921 | foreach subCat [lsort -increasing -unique [readdir $pathToCategory]] { |
| 922 | set pathToSubCat [file join $pathToCategory $subCat] |
| 923 | foreach port [lsort -increasing -unique [readdir $pathToSubCat]] { |
| 924 | set pathToPort [file join $pathToSubCat $port] |
| 925 | if {[file isdirectory $pathToPort] && |
| 926 | [file exists [file join $pathToPort "Portfile"]]} { |
| 927 | # Call the function. |
| 928 | $func [file join $category $subCat $port] |
| 929 | |
| 930 | # Restore the current directory because some |
| 931 | # functions changes it. |
| 932 | cd $pathToRoot |
| 933 | } |
| 934 | } |
| 935 | } |
| 936 | } |
| 937 | } |