void GenericMeshFileReader::read(IMeshBuilder& builder) { const filesystem::path filepath(impl->m_filename); const string extension = lower_case(filepath.extension().string()); if (extension == ".obj") { OBJMeshFileReader reader(impl->m_filename, impl->m_obj_options); reader.read(builder); } else if (extension == ".abc") { AlembicMeshFileReader reader(impl->m_filename); reader.read(builder); } else if (extension == ".binarymesh") { BinaryMeshFileReader reader(impl->m_filename); reader.read(builder); } else { throw ExceptionUnsupportedFileFormat(impl->m_filename.c_str()); } }
std::string GetFilenameWithoutExtension(const filesystem::path& filePath) { auto extension = filePath.extension(); auto filename = filePath.filename(); return !extension.empty() ? filename.substr(0, filename.length() - extension.length() - 1) : filename; }