From 0693131a15e21f00b80c0810d3b339490d9d9a7a Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Thu, 13 Aug 2009 10:33:56 +0200 Subject: [PATCH] bugfix argList.C - now export FOAM_CASE and FOAM_CASENAME environment variables from getRootCase() so they can be used immediately (eg, in decomposeParDict) instead of crashing! --- src/OpenFOAM/global/argList/argList.C | 42 +++++++++++++++------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/src/OpenFOAM/global/argList/argList.C b/src/OpenFOAM/global/argList/argList.C index 73a753157ea..845b852e95b 100644 --- a/src/OpenFOAM/global/argList/argList.C +++ b/src/OpenFOAM/global/argList/argList.C @@ -117,6 +117,10 @@ bool Foam::argList::regroupArgv(int& argc, char**& argv) // get rootPath_ / globalCase_ from one of the following forms // * [-case dir] // * cwd +// +// Also export FOAM_CASE and FOAM_CASENAME environment variables +// so they can be used immediately (eg, in decomposeParDict) +// void Foam::argList::getRootCase() { fileName casePath; @@ -151,6 +155,26 @@ void Foam::argList::getRootCase() rootPath_ = casePath.path(); globalCase_ = casePath.name(); case_ = globalCase_; + + + // Set the case and case-name as an environment variable + if (rootPath_[0] == '/') + { + // absolute path - use as-is + setEnv("FOAM_CASE", rootPath_/globalCase_, true); + setEnv("FOAM_CASENAME", globalCase_, true); + } + else + { + // qualify relative path + fileName casePath = cwd()/rootPath_/globalCase_; + casePath.clean(); + + setEnv("FOAM_CASE", casePath, true); + setEnv("FOAM_CASENAME", casePath.name(), true); + } + + } @@ -531,24 +555,6 @@ Foam::argList::argList } jobInfo.write(); - - // Set the case and case-name as an environment variable - if (rootPath_[0] == '/') - { - // absolute path - use as-is - setEnv("FOAM_CASE", rootPath_/globalCase_, true); - setEnv("FOAM_CASENAME", globalCase_, true); - } - else - { - // qualify relative path - fileName casePath = cwd()/rootPath_/globalCase_; - casePath.clean(); - - setEnv("FOAM_CASE", casePath, true); - setEnv("FOAM_CASENAME", casePath.name(), true); - } - // Switch on signal trapping. We have to wait until after Pstream::init // since this sets up its own ones. sigFpe_.set(bannerEnabled); -- GitLab