Debian Codegraph @

doc/example/compiler-etc-dependencies/tcllib/ChildModules.tcl

raw
1 # ======= Information re modules beneath current dir =====
2 # Author: Tom Payerle <[email protected]>
3
4 #--------------------------------------------------------------------
5 # FirstChildModuleInList
6 #
7 # Given a list of names of modulefile components, returns the
8 # first one found in the directory of the current modulefile
9 # (typically a .modulerc file). Returns empty string if none
10 # of them were found.
11 # NOTE: we do NOT check for module magic signature or even that symlink
12 # targets exist.
13 proc FirstChildModuleInList { modlist } {
14 global ModulesCurrentModulefile
15 # Get directory for current modulefile
16 set moduledir [ file dirname $ModulesCurrentModulefile ]
17 # See if any names in $modlist in moduledir
18 foreach mcomp $modlist {
19 if [ file exists $moduledir/$mcomp ] { return $mcomp }
20 }
21 # Nothing found
22 return
23 }
24
25 #--------------------------------------------------------------------
26 # ChildModuleExists
27 #
28 # Takes a module path component, and returns true if that path component
29 # exists beneath the current level, i.e. in the directory from which
30 # this .modulerc file was called.
31 # NOTE: we do NOT check for module magic signature or even that symlink
32 # targets exist.
33 proc ChildModuleExists { pathcomponent } {
34 global ModulesCurrentModulefile
35 # Get directory for current modulefile
36 set moduledir [ file dirname $ModulesCurrentModulefile ]
37 # See if file exists in moduledir
38 return [ file exists $moduledir/$pathcomponent ]
39 }