etcFiles.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2016-2018 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 InNamespace
25  Foam
26 
27 Description
28  Functions to search 'etc' directories for configuration files etc.
29 
30 SourceFiles
31  etcFiles.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef etcFiles_H
36 #define etcFiles_H
37 
38 #include "fileNameList.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 //- Search for directories from user/group/shipped directories.
48 // The search scheme allows for version-specific and
49 // version-independent files using the following hierarchy:
50 // - \b user settings:
51 // - ~/.OpenFOAM/<VERSION>
52 // - ~/.OpenFOAM/
53 // - \b group (site) settings (when $WM_PROJECT_SITE is set):
54 // - $WM_PROJECT_SITE/<VERSION>
55 // - $WM_PROJECT_SITE
56 // - \b group (site) settings (when $WM_PROJECT_SITE is not set):
57 // - $WM_PROJECT_INST_DIR/site/<VERSION>
58 // - $WM_PROJECT_INST_DIR/site/
59 // - \b other (shipped) settings:
60 // - $WM_PROJECT_DIR/etc/
61 //
62 // \return The list of full paths of all the matching directories or
63 // an empty list if the name cannot be found.
64 fileNameList findEtcDirs(const fileName& local = fileName::null);
65 
66 //- Search for files from user/group/shipped directories.
67 // The search scheme allows for version-specific and
68 // version-independent files using the following hierarchy:
69 // - \b user settings:
70 // - ~/.OpenFOAM/<VERSION>
71 // - ~/.OpenFOAM/
72 // - \b group (site) settings (when $WM_PROJECT_SITE is set):
73 // - $WM_PROJECT_SITE/<VERSION>
74 // - $WM_PROJECT_SITE
75 // - \b group (site) settings (when $WM_PROJECT_SITE is not set):
76 // - $WM_PROJECT_INST_DIR/site/<VERSION>
77 // - $WM_PROJECT_INST_DIR/site/
78 // - \b other (shipped) settings:
79 // - $WM_PROJECT_DIR/etc/
80 //
81 // \return The list of full paths of all the matching files or
82 // an empty list if the name cannot be found.
83 // Optionally abort if the file cannot be found.
84 // Optionally stop search after the first file has been found.
86 (
87  const fileName&,
88  bool mandatory=false,
89  bool findFirst=false
90 );
91 
92 //- Search for a file using findEtcFiles.
93 // \return The full path name of the first file found in the
94 // search hierarchy or an empty fileName if the name cannot be found.
95 // Optionally abort if the file cannot be found.
96 fileName findEtcFile(const fileName&, bool mandatory=false);
97 
98 
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
100 
101 } // End namespace Foam
102 
103 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
104 
105 #endif
106 
107 // ************************************************************************* //
static const fileName null
An empty fileName.
Definition: fileName.H:97
fileNameList findEtcFiles(const fileName &, bool mandatory=false, bool findFirst=false)
Search for files from user/group/shipped directories.
Definition: etcFiles.C:119
fileName findEtcFile(const fileName &, bool mandatory=false)
Search for a file using findEtcFiles.
Definition: etcFiles.C:252
List< fileName > fileNameList
A List of fileNames.
Definition: fileNameList.H:50
Namespace for OpenFOAM.
fileNameList findEtcDirs(const fileName &local=fileName::null)
Search for directories from user/group/shipped directories.
Definition: etcFiles.C:32