From 0cbbefb3a64d555125249227b188cbbeae4b2905 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Tue, 10 Jun 2008 10:23:14 +0200 Subject: [PATCH] Revert string expansion of leading '.' and './' to the original behaviour. * Now that the expansion of FOAM_CASE is delayed in the boundary conditions, the old expansion is simpler and seems to work better with IOobjects. --- .../primitives/strings/string/string.C | 32 +++++-------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/src/OpenFOAM/primitives/strings/string/string.C b/src/OpenFOAM/primitives/strings/string/string.C index d131a686ca..dac116893c 100644 --- a/src/OpenFOAM/primitives/strings/string/string.C +++ b/src/OpenFOAM/primitives/strings/string/string.C @@ -209,32 +209,16 @@ Foam::string& Foam::string::expand() *this = home(user)/file; } } - else + else if (operator[](0) == '.') { - // expand a lone initial '.' and './' into CWD - // otherwise strip leading './' sequences - while - ( - operator[](0) == '.' - && (size() == 1 || operator[](1) == '/') - ) + // Expand initial '.' and './' into cwd + if (size() == 1) { - // handle leading ".////" as well - size_type slashPos = 1; - while (size() > slashPos && operator[](slashPos) == '/') - { - ++slashPos; - } - - if (size() <= slashPos) - { - *this = cwd(); - break; - } - else - { - std::string::erase(0, slashPos); - } + *this = cwd(); + } + else if (operator[](1) == '/') + { + std::string::replace(0, 1, cwd()); } } }