diff --git a/dali/base/dadfs.cpp b/dali/base/dadfs.cpp index 34386e0cc4f..fff8920ae73 100644 --- a/dali/base/dadfs.cpp +++ b/dali/base/dadfs.cpp @@ -118,6 +118,16 @@ inline unsigned groupDistance(IGroup *grp1,IGroup *grp2) return grp1->distance(grp2); } +inline StringBuffer &appendEnsurePathSepChar(StringBuffer &dest, StringBuffer &newPart, char psc) +{ + addPathSepChar(dest, psc); + if (isPathSepChar(newPart.charAt(0))) + dest.append(newPart.str()+1); + else + dest.append(newPart); + return dest; +} + static StringBuffer &normalizeFormat(StringBuffer &in) { @@ -4474,12 +4484,8 @@ protected: friend class CDistributedFilePart; if (isPathSepChar(newPath.charAt(newPath.length()-1))) newPath.setLength(newPath.length()-1); newPath.remove(0, myBase.length()); - // Ensure one path separator between baseDir and newPath - newdir.append(addPathSepChar(baseDir, psc)); - if (isPathSepChar(newPath.charAt(0))) - newdir.append(newPath.str()+1); - else - newdir.append(newPath); + newdir.append(baseDir); + appendEnsurePathSepChar(newdir, newPath, psc); StringBuffer fullname; CIArrayOf newNames; unsigned i; @@ -4498,7 +4504,8 @@ protected: friend class CDistributedFilePart; StringBuffer copyDir(baseDir); adjustClusterDir(i, copy, copyDir); - fullname.clear().append(copyDir).append(newPath); + fullname.clear().append(copyDir); + appendEnsurePathSepChar(fullname, newPath, psc); newNames.item(i).append(fullname); } }