bool KFile::setFile(KData fullFilePath, int mode) { if (m_bIsOpen) { fclose (m_hFile); m_bIsOpen = false; } #ifndef WIN32 replaceAll(fullFilePath); #endif if (fullFilePath.find("/") == -1) //斜杠…… { m_kFilePath = "./"; m_kFileName = fullFilePath; } else { KData tStr = fullFilePath; if (tStr[tStr.length() - 1] == '/') { return false; } else { int pos = tStr.findlast("/"); m_kFilePath = tStr.substr(0, pos + 1); m_kFileName = tStr.substr(pos + 1, tStr.length() - pos - 1); } } return open(mode); }