Skip to content

Commit

Permalink
HPCC-29721 review changes
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <jake.smith@lexisnexisrisk.com>
  • Loading branch information
jakesmith committed Nov 9, 2023
1 parent b226370 commit 6e42188
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions dali/base/dafdesc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2949,21 +2949,47 @@ bool setReplicateDir(const char *dir,StringBuffer &out,bool isrep,const char *ba
{
if (dir[i]==0)
{
// dir was an exact match for the base directory, return replica directory in output
out.append(r);
return true;
}
else if (isPathSepChar(dir[i])) // should mean that the last char of d was not a pathsepchar
else if (isPathSepChar(dir[i]))
{
out.append(r).append(dir+i);
// dir matched the prefix of the base directory and the remaining part leads with a path separator
// replace the base directory with the replica directory in the output, and append the remaining part of dir
out.append(r);
if (isPathSepChar(out.charAt(out.length()-1))) // if r has trailing path separator, skip the leading one in dir
i++;
out.append(dir+i);
return true;
}
else if (i>0 && isPathSepChar(d[i-1])) // implies dir[i-1] is also a pathsepchar
{
out.append(r).append(dir+i);
// dir matched the prefix of the base directory, including the trailing path separator
// replace the base directory with the replica directory in the output, and append the remaining part of dir
out.append(r);
addPathSepChar(out); // NB: this is an ensure-has-trailing-path-separator
out.append(dir+i); // NB: dir+i is beyond a path separator in dir
return true;
}
}

else if (count) // this is a bit of a kludge to handle roxie backup
{
const char *s = r;
const char *b = s;
while (s&&*s)
{
if (isPathSepChar(*s))
{
if (--count==0)
{
out.append(s-b,b).append(dir+match);
return true;
}
}
s++;
}
}
return false;
}

Expand Down

0 comments on commit 6e42188

Please sign in to comment.