X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8d94819c437fdf28c45e9f328e6c38fd1c639ddf..3d777efedc1e05bd6c2a7c34a00a65895b62bb13:/src/html/helpdata.cpp diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index f67b1689c8..c60c74e626 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -4,7 +4,6 @@ // Notes: Based on htmlhelp.cpp, implementing a monolithic // HTML Help controller class, by Vaclav Slavik // Author: Harm van der Heijden and Vaclav Slavik -// RCS-ID: $Id$ // Copyright: (c) Harm van der Heijden and Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -245,7 +244,7 @@ bool HP_TagHandler::HandleTag(const wxHtmlTag& tag) wxString wxHtmlBookRecord::GetFullPath(const wxString &page) const { - if (wxIsAbsolutePath(page)) + if (wxIsAbsolutePath(page) || page.Find(wxT("file:")) == 0) return page; else return m_BasePath + page; @@ -475,11 +474,11 @@ void wxHtmlHelpData::SetTempDir(const wxString& path) m_tempPath = path; else { - if (wxIsAbsolutePath(path)) m_tempPath = path; - else m_tempPath = wxGetCwd() + wxT("/") + path; + wxFileName fn; + fn.AssignDir(path); + fn.MakeAbsolute(); - if (m_tempPath[m_tempPath.length() - 1] != wxT('/')) - m_tempPath << wxT('/'); + m_tempPath = fn.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR); } } @@ -501,6 +500,18 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, const wxString& indexfile, const wxString& deftopic, const wxString& path) { +#if wxUSE_WCHAR_T + #if wxUSE_UNICODE + #define CORRECT_STR(str, conv) \ + str = wxString((str).mb_str(wxConvISO8859_1), conv) + #else + #define CORRECT_STR(str, conv) \ + str = wxString((str).wc_str(conv), wxConvLocal) + #endif +#else + #define CORRECT_STR(str, conv) +#endif + wxFileSystem fsys; wxFSFile *fi; wxHtmlBookRecord *bookr; @@ -518,7 +529,16 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, return true; // book is (was) loaded } - bookr = new wxHtmlBookRecord(bookfile.GetLocation(), fsys.GetPath(), title, deftopic); + wxString title1 = title; + if (encoding != wxFONTENCODING_SYSTEM) + { + wxCSConv conv(encoding); + CORRECT_STR(title1, conv); + if (title1.IsEmpty() && !title.IsEmpty()) + title1 = title; + } + + bookr = new wxHtmlBookRecord(bookfile.GetLocation(), fsys.GetPath(), title1, deftopic); wxHtmlHelpDataItem *bookitem = new wxHtmlHelpDataItem; bookitem->level = 0; @@ -575,13 +595,6 @@ bool wxHtmlHelpData::AddBookParam(const wxFSFile& bookfile, // differences here and also convert to wxConvLocal in ANSI build if (encoding != wxFONTENCODING_SYSTEM) { - #if wxUSE_UNICODE - #define CORRECT_STR(str, conv) \ - str = wxString((str).mb_str(wxConvISO8859_1), conv) - #else - #define CORRECT_STR(str, conv) \ - str = wxString((str).wc_str(conv), wxConvLocal) - #endif wxCSConv conv(encoding); size_t IndexCnt = m_index.size(); size_t ContentsCnt = m_contents.size();