#include "yardim.hpp" #include #include #include #include "fiko/core/gunluk.hpp" #ifdef FIKO_CEF #include "yardim_cef.hpp" #endif namespace fiko { namespace { // Yardım dokümanlarının kökü. assets/ yalnız depoda (exe yanına kopyalanmıyor — // wtec_kafa_penceresi.cpp'deki asset yolu kalıbıyla aynı). Exe-yanı assets/yardim // varsa onu tercih eder (dağıtım), yoksa depo köküne düşer (geliştirme). std::filesystem::path yardimKok() { wchar_t exeYol[MAX_PATH]{}; GetModuleFileNameW(nullptr, exeYol, MAX_PATH); const std::filesystem::path yaniAssets = std::filesystem::path(exeYol).parent_path() / L"assets" / L"yardim"; std::error_code ec; if (std::filesystem::exists(yaniAssets, ec)) return yaniAssets; return std::filesystem::path( L"D:/__sistem__/Masaustu/FikoYT.Yeni.Cag/fikatia-local/assets/yardim"); } } // namespace void yardimAc(const std::string& dosya) { const int n = MultiByteToWideChar(CP_UTF8, 0, dosya.c_str(), -1, nullptr, 0); std::wstring wDosya(n > 0 ? n - 1 : 0, L'\0'); if (n > 1) MultiByteToWideChar(CP_UTF8, 0, dosya.c_str(), -1, wDosya.data(), n); const std::filesystem::path tam = yardimKok() / wDosya; std::error_code ec; if (!std::filesystem::exists(tam, ec)) { gunluk::hata("Yardım dokümanı bulunamadı: {}", tam.string()); return; } #ifdef FIKO_CEF // Gömülü CEF penceresinde aç (çevrimdışı, uygulama içi görüntüleyici). yardimCefAc(tam.string()); #else // CEF yoksa sistem tarayıcısında aç (doküman yine görüntülenir). const HINSTANCE r = ShellExecuteW(nullptr, L"open", tam.wstring().c_str(), nullptr, nullptr, SW_SHOWNORMAL); if ((INT_PTR)r <= 32) gunluk::hata("Yardım açılamadı (ShellExecute {}): {}", (INT_PTR)r, tam.string()); #endif } } // namespace fiko