| 1798 | } |
| 1799 | |
| 1800 | bool IGFD::FileInfos::FinalizeFileTypeParsing(const size_t& vMaxDotToExtract) { |
| 1801 | if (fileType.isFile() || fileType.isLinkToUnknown()) { // link can have the same extention of a file |
| 1802 | countExtDot = Utils::GetCharCountInString(fileNameExt, '.'); |
| 1803 | size_t lpt = 0U; |
| 1804 | if (countExtDot > 1U) { // multi layer ext |
| 1805 | size_t max_dot_to_extract = vMaxDotToExtract; |
| 1806 | if (max_dot_to_extract > countExtDot) { |
| 1807 | max_dot_to_extract = countExtDot; |
| 1808 | } |
| 1809 | lpt = Utils::GetLastCharPosWithMinCharCount(fileNameExt, '.', max_dot_to_extract); |
| 1810 | } else { |
| 1811 | lpt = fileNameExt.find_first_of('.'); |
| 1812 | } |
| 1813 | if (lpt != std::string::npos) { |
| 1814 | size_t lvl = 0U; |
| 1815 | fileNameLevels[lvl] = fileNameExt.substr(0, lpt); |
| 1816 | fileNameLevels[lvl] = Utils::LowerCaseString(fileNameLevels[lvl]); |
| 1817 | fileExtLevels[lvl] = fileNameExt.substr(lpt); |
| 1818 | fileExtLevels_optimized[lvl] = Utils::LowerCaseString(fileExtLevels[lvl]); |
| 1819 | if (countExtDot > 1U) { // multi layer ext |
| 1820 | auto count = countExtDot; |
| 1821 | while (count > 0 && lpt != std::string::npos && lvl < fileExtLevels.size()) { |
| 1822 | ++lpt; |
| 1823 | ++lvl; |
| 1824 | if (fileNameExt.size() > lpt) { |
| 1825 | lpt = fileNameExt.find_first_of('.', lpt); |
| 1826 | if (lpt != std::string::npos) { |
| 1827 | fileNameLevels[lvl] = fileNameExt.substr(0, lpt); |
| 1828 | fileNameLevels[lvl] = Utils::LowerCaseString(fileNameLevels[lvl]); |
| 1829 | fileExtLevels[lvl] = fileNameExt.substr(lpt); |
| 1830 | fileExtLevels_optimized[lvl] = Utils::LowerCaseString(fileExtLevels[lvl]); |
| 1831 | } |
| 1832 | } |
| 1833 | } |
| 1834 | } |
| 1835 | } |
| 1836 | return true; |
| 1837 | } |
| 1838 | return false; |
| 1839 | } |
| 1840 | |
| 1841 | IGFD::FileManager::FileManager() { |
| 1842 | fsRoot = IGFD::Utils::GetPathSeparator(); |
no test coverage detected