void file_utils::combine_path_and_extension(dynamic_string &dst, const char *pA, const char *pB, const char *pC, const char *pExt) { combine_path(dst, pA, pB, pC); if ((!dst.ends_with(".")) && (pExt[0]) && (pExt[0] != '.')) dst.append_char('.'); dst.append(pExt); }
bool data_stream::read_line(dynamic_string &str) { str.empty(); for (;;) { const int c = read_byte(); const bool prev_got_cr = m_got_cr; m_got_cr = false; if (c < 0) { if (!str.is_empty()) break; return false; } // ignores DOS EOF, assumes it's at the very end of the file else if ((26 == c) || (!c)) continue; else if (13 == c) { m_got_cr = true; break; } else if (10 == c) { if (prev_got_cr) continue; break; } str.append_char(static_cast<char>(c)); } return true; }
bool data_stream::read_line(dynamic_string &str) { str.empty(); for (;;) { // Can't be const--need to deal with Mac OS9 style line endings via substition const int c = read_byte(); if (c < 0) { if (!str.is_empty()) break; return false; } // ignores DOS EOF, assumes it's at the very end of the file else if ((26 == c) || (!c)) continue; else if (c_CR == c) { // This path handles OS9 and Windows style line endings. // Check to see if the next character is a LF, if so eat that one too. if (c_LF == peek_byte()) { read_byte(); } break; } else if (c_LF == c) { // UNIX style line endings. break; } str.append_char(static_cast<char>(c)); } return true; }