| 2094 | } |
| 2095 | |
| 2096 | void IGFD::FileManager::m_AddFile(const FileDialogInternal& vFileDialogInternal, const std::string& vPath, const std::string& vFileName, const FileType& vFileType) { |
| 2097 | auto pInfos = FileInfos::create(); |
| 2098 | |
| 2099 | pInfos->filePath = vPath; |
| 2100 | pInfos->fileNameExt = vFileName; |
| 2101 | pInfos->fileNameExt_optimized = Utils::LowerCaseString(pInfos->fileNameExt); |
| 2102 | pInfos->fileType = vFileType; |
| 2103 | |
| 2104 | if (pInfos->fileNameExt.empty() || (pInfos->fileNameExt == "." && !vFileDialogInternal.filterManager.dLGFilters.empty())) { // filename empty or filename is the current dir '.' //-V807 |
| 2105 | return; |
| 2106 | } |
| 2107 | |
| 2108 | if (pInfos->fileNameExt != ".." && (vFileDialogInternal.getDialogConfig().flags & ImGuiFileDialogFlags_DontShowHiddenFiles) && pInfos->fileNameExt[0] == '.') { // dont show hidden files |
| 2109 | if (!vFileDialogInternal.filterManager.dLGFilters.empty() || (vFileDialogInternal.filterManager.dLGFilters.empty() && pInfos->fileNameExt != ".")) { // except "." if in directory mode //-V728 |
| 2110 | return; |
| 2111 | } |
| 2112 | } |
| 2113 | |
| 2114 | if (pInfos->FinalizeFileTypeParsing(vFileDialogInternal.filterManager.GetSelectedFilter().count_dots)) { |
| 2115 | if (!vFileDialogInternal.filterManager.IsCoveredByFilters(*pInfos.get(), // |
| 2116 | (vFileDialogInternal.getDialogConfig().flags & ImGuiFileDialogFlags_CaseInsensitiveExtentionFiltering) != 0)) { |
| 2117 | return; |
| 2118 | } |
| 2119 | } |
| 2120 | |
| 2121 | vFileDialogInternal.filterManager.FillFileStyle(pInfos); |
| 2122 | |
| 2123 | m_CompleteFileInfos(pInfos); |
| 2124 | |
| 2125 | if (m_CompleteFileInfosWithUserFileAttirbutes(vFileDialogInternal, pInfos)) { |
| 2126 | m_FileList.push_back(pInfos); |
| 2127 | } |
| 2128 | } |
| 2129 | |
| 2130 | void IGFD::FileManager::m_AddPath(const FileDialogInternal& vFileDialogInternal, const std::string& vPath, const std::string& vFileName, const FileType& vFileType) { |
| 2131 | if (!vFileType.isDir()) return; |
nothing calls this directly
no test coverage detected