mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: subsequent command options are ignored (issue #424)
- adjust so that the final -option is taken. This is consistent with other Unix tools. ENH: short-circuit to avoid directory check on non-master node
This commit is contained in:
@ -489,7 +489,8 @@ Foam::argList::argList
|
|||||||
|
|
||||||
argListStr_ += ' ';
|
argListStr_ += ' ';
|
||||||
argListStr_ += args_[argI];
|
argListStr_ += args_[argI];
|
||||||
options_.insert(optionName, args_[argI]);
|
// Handle duplicates by taking the last -option specified
|
||||||
|
options_.set(optionName, args_[argI]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -584,8 +585,8 @@ void Foam::argList::parse
|
|||||||
|
|
||||||
if (initialise)
|
if (initialise)
|
||||||
{
|
{
|
||||||
string dateString = clock::date();
|
const string dateString = clock::date();
|
||||||
string timeString = clock::clockTime();
|
const string timeString = clock::clockTime();
|
||||||
|
|
||||||
// Print the banner once only for parallel runs
|
// Print the banner once only for parallel runs
|
||||||
if (Pstream::master() && bannerEnabled)
|
if (Pstream::master() && bannerEnabled)
|
||||||
@ -1248,11 +1249,12 @@ bool Foam::argList::check(bool checkArgs, bool checkOpts) const
|
|||||||
|
|
||||||
if (Pstream::master())
|
if (Pstream::master())
|
||||||
{
|
{
|
||||||
if (checkArgs && args_.size() - 1 != validArgs.size())
|
const label nargs = args_.size()-1;
|
||||||
|
if (checkArgs && nargs != validArgs.size())
|
||||||
{
|
{
|
||||||
FatalError
|
FatalError
|
||||||
<< "Wrong number of arguments, expected " << validArgs.size()
|
<< "Wrong number of arguments, expected " << validArgs.size()
|
||||||
<< " found " << args_.size() - 1 << endl;
|
<< " found " << nargs << endl;
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1260,14 +1262,15 @@ bool Foam::argList::check(bool checkArgs, bool checkOpts) const
|
|||||||
{
|
{
|
||||||
forAllConstIter(HashTable<string>, options_, iter)
|
forAllConstIter(HashTable<string>, options_, iter)
|
||||||
{
|
{
|
||||||
|
const word& optionName = iter.key();
|
||||||
if
|
if
|
||||||
(
|
(
|
||||||
!validOptions.found(iter.key())
|
!validOptions.found(optionName)
|
||||||
&& !validParOptions.found(iter.key())
|
&& !validParOptions.found(optionName)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
FatalError
|
FatalError
|
||||||
<< "Invalid option: -" << iter.key() << endl;
|
<< "Invalid option: -" << optionName << endl;
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1295,7 +1298,7 @@ bool Foam::argList::checkRootCase() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isDir(path()) && Pstream::master())
|
if (Pstream::master() && !isDir(path()))
|
||||||
{
|
{
|
||||||
// Allow slaves on non-existing processor directories, created later
|
// Allow slaves on non-existing processor directories, created later
|
||||||
FatalError
|
FatalError
|
||||||
|
|||||||
Reference in New Issue
Block a user