bool VDirAdapter_Unix::extractFileName(const VString &strPath, VString &strName, VString &strTitle) const { bool bResult = false; strName = strPath; size_t nPos = strName.rfind("."); size_t nCount = nPos; size_t nOffset = 0; if (nPos == 0) strTitle = ""; else strTitle = strPath.substr(nOffset, nCount); m_bExtractName = true; return bResult; }
bool VDirAdapter_Unix::extractExt(const VString &strName, VString &strExt) { bool bResult = false; size_t nPos = strName.rfind("."); if (nPos != -1) { bResult = true; size_t nLength = strName.length(); size_t nCount = nLength - nPos - 1; size_t nOffset = nPos + 1; strExt = strName.substr(nOffset, nCount); } else { bResult = false; } return bResult; }
bool VDirAdapter::extractRoot(const VString &strFilePath, VString &strRoot) { bool bResult = false; size_t nPos = strFilePath.rfind("/"); if (nPos == -1) { nPos = strFilePath.rfind("\\"); } if (nPos != -1) { bResult = true; size_t nCount = nPos + 1; size_t nOffset = 0; strRoot = strFilePath.substr(nOffset, nCount); } else { bResult = false; } return bResult; }