void CUIExtensionMgr::Initialize() const { if (m_bInitialized) return; // we need a non-const pointer to update the array CUIExtensionMgr* pMgr = const_cast<CUIExtensionMgr*>(this); // look at every dll from wherever we are now CFileFind ff; CString sSearchPath = FileMisc::GetAppFileName(), sFolder, sDrive; FileMisc::SplitPath(sSearchPath, &sDrive, &sFolder); FileMisc::MakePath(sSearchPath, sDrive, sFolder, _T("*"), _T(".dll")); BOOL bContinue = ff.FindFile(sSearchPath); while (bContinue) { bContinue = ff.FindNextFile(); if (!ff.IsDots() && !ff.IsDirectory()) { CString sDllPath = ff.GetFilePath(); if (IsUIExtemsionDll(sDllPath)) { IUIExtension* pExtension = CreateUIExtensionInterface(sDllPath); if (pExtension) { // init translator pExtension->SetLocalizer(CLocalizer::GetLocalizer()); // save pMgr->m_aUIExtensions.Add(pExtension); } } } } pMgr->m_bInitialized = TRUE; }
void CUIExtensionMgr::Initialize() { if (m_bInitialized) { return; } // look at every dll from wherever we are now CFileFind ff; CString sSearchPath = FileMisc::GetAppFileName(), sFolder, sDrive; FileMisc::SplitPath(sSearchPath, &sDrive, &sFolder); FileMisc::MakePath(sSearchPath, sDrive, sFolder, _T("*"), _T(".dll")); BOOL bContinue = ff.FindFile(sSearchPath); while (bContinue) { bContinue = ff.FindNextFile(); if (!ff.IsDots() && !ff.IsDirectory()) { CString sDllPath = ff.GetFilePath(); if (IsUIExtemsionDll(sDllPath)) { IUIExtension* m_pExtension = CreateUIExtensionInterface(sDllPath); if (m_pExtension) { m_aUIExtensions.Add(new CUIExtension(m_pExtension)); } } } } m_bInitialized = TRUE; }