ENH: support search modes for etcFiles()

- similar to the foamEtcFile script -mode=... option, the specific
  search location (user/group/other) can now also specified for
  string expansions and as a numerical value for etcFile()

  For example, if searching for group or other (project) controlDict,
  but not wishing to see the user controlDict:

    1.  foamEtcFile -mode=go controlDict

    2.  fileName dictFile("<etc:go>/controlDict");
        dictFile.expand();

    3.  etcFile(controlDict, false, 0077);

  The default behaviour for searching all contexts is unchanged.

    1.  foamEtcFile controlDict

    2.  fileName dictFile("<etc>/controlDict");
        dictFile.expand();

    3.  etcFile(controlDict);
This commit is contained in:
Mark Olesen
2018-12-12 13:45:32 +01:00
parent 67140f6b07
commit 172c36c29a
7 changed files with 220 additions and 71 deletions

View File

@ -240,12 +240,13 @@ int main(int argc, char *argv[])
fileName baseDir
(
"${WM_PROJECT_DIR}/etc/caseDicts/createZeroDirectoryTemplates"
args.opt<fileName>
(
"templateDir",
// Default is from PROJECT/etc directory
"<etc:o>/caseDicts/createZeroDirectoryTemplates"
)
);
if (args.found("templateDir"))
{
baseDir = args["templateDir"];
}
baseDir.expand();
baseDir.toAbsolute();