source: CPL/oasis3-mct/branches/OASIS3-MCT_2.0_branch/util/oasisgui/opentea/config.tcl @ 4775

Last change on this file since 4775 was 4775, checked in by aclsce, 5 years ago
  • Imported oasis3-mct from Cerfacs svn server (not suppotred anymore).

The version has been extracted from https://oasis3mct.cerfacs.fr/svn/branches/OASIS3-MCT_2.0_branch/oasis3-mct@1818

File size: 2.5 KB
Line 
1#  This program is under CECILL_B licence. See footer for details.
2
3proc getConfig {address} {
4    # This function retrieves the config file, selects the relevant element from address (without the "root") and return its value
5   
6    global configPath configTree
7   
8    # Retrieve the file if it has not been done yet
9    if {$configTree == ""} {
10        dTree_init configTree
11        if {[file exists $configPath]} {
12            parseFile $configPath configTree "" "DStree"
13        } else {
14            close [open $configPath "w"]
15            return ""
16        }
17       
18    }
19
20    if {![dTree_nodeExists $configTree "root dataset config"]} {
21        popup_error "Config file is empty..."
22    }
23   
24    if {[catch {set value [dTree_getAttribute $configTree "root dataset $address" value]} err]} {
25        #error "The address $address doesn't exist in the config tree"
26        return ""
27    }
28   
29    return $value
30}
31
32
33#  Copyright CERFACS 2014
34#   
35#  antoine.dauptain@cerfacs.fr
36#   
37#  This software is a computer program whose purpose is to ensure technology
38#  transfer between academia and industry.
39#   
40#  This software is governed by the CeCILL-B license under French law and
41#  abiding by the rules of distribution of free software.  You can  use,
42#  modify and/ or redistribute the software under the terms of the CeCILL-B
43#  license as circulated by CEA, CNRS and INRIA at the following URL
44#  "http://www.cecill.info".
45#   
46#  As a counterpart to the access to the source code and  rights to copy,
47#  modify and redistribute granted by the license, users are provided only
48#  with a limited warranty  and the software's author,  the holder of the
49#  economic rights,  and the successive licensors  have only  limited
50#  liability.
51#   
52#  In this respect, the user's attention is drawn to the risks associated
53#  with loading,  using,  modifying and/or developing or reproducing the
54#  software by the user in light of its specific status of free software,
55#  that may mean  that it is complicated to manipulate,  and  that  also
56#  therefore means  that it is reserved for developers  and  experienced
57#  professionals having in-depth computer knowledge. Users are therefore
58#  encouraged to load and test the software's suitability as regards their
59#  requirements in conditions enabling the security of their systems and/or
60#  data to be ensured and,  more generally, to use and operate it in the
61#  same conditions as regards security.
62#   
63#  The fact that you are presently reading this means that you have had
64#  knowledge of the CeCILL-B license and that you accept its terms.
Note: See TracBrowser for help on using the repository browser.