void AppendCharIfAbsent( std::basic_string<_Elem, _Traits, _Ax>& str, _Elem c) { typedef std::basic_string<_Elem, _Traits, _Ax> string_type; string_type::reverse_iterator r_iter = str.rbegin(); if(*r_iter != c) str.append(1, c); }
std::basic_string<Char> PathJoin(const std::basic_string<Char>& dir, const std::basic_string<Char>& file) { if(dir.empty()) return file; Char c = *(dir.rbegin()); switch(c) { case '\\': case '/': return dir + file; } std::basic_string<Char> ret(dir); ret.push_back('\\'); ret.append(file); return ret; }