X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/729e4ab9bc6618bc3d8a898e575df7f4019e29ca..4388f060552cc537e71e957d32f35e9d75a61233:/icuSources/common/charstr.cpp?ds=sidebyside diff --git a/icuSources/common/charstr.cpp b/icuSources/common/charstr.cpp index cdd58281..76723d97 100644 --- a/icuSources/common/charstr.cpp +++ b/icuSources/common/charstr.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************* -* Copyright (C) 2010, International Business Machines +* Copyright (C) 2010-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: charstr.cpp @@ -127,4 +127,19 @@ UBool CharString::ensureCapacity(int32_t capacity, return TRUE; } +CharString &CharString::appendPathPart(const StringPiece &s, UErrorCode &errorCode) { + if(U_FAILURE(errorCode)) { + return *this; + } + if(s.length()==0) { + return *this; + } + char c; + if(len>0 && (c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) { + append(U_FILE_SEP_CHAR, errorCode); + } + append(s, errorCode); + return *this; +} + U_NAMESPACE_END