diff --git a/uppsrc/Core/Path.cpp b/uppsrc/Core/Path.cpp index fc0a62073..245ae0617 100644 --- a/uppsrc/Core/Path.cpp +++ b/uppsrc/Core/Path.cpp @@ -397,6 +397,7 @@ FindFile::FindFile(const char *name) { } bool FindFile::Search(const char *name) { + pattern = GetFileName(name); Close(); if(w) handle = UnicodeWin32().FindFirstFileW(ToSystemCharsetW(name), w); @@ -410,7 +411,7 @@ void FindFile::Close() { handle = INVALID_HANDLE_VALUE; } -bool FindFile::Next() { +bool FindFile::Next0() { if(w) { if(!UnicodeWin32().FindNextFileW(handle, w)) { Close(); @@ -426,6 +427,16 @@ bool FindFile::Next() { return true; } +bool FindFile::Next() +{ + for(;;) { + if(!Next0()) + return false; + if(PatternMatch(pattern, GetName())) + return true; + } +} + dword FindFile::GetAttributes() const { return w ? w->dwFileAttributes : a->dwFileAttributes; diff --git a/uppsrc/Core/Path.h b/uppsrc/Core/Path.h index 625c694ff..b09b78a9f 100644 --- a/uppsrc/Core/Path.h +++ b/uppsrc/Core/Path.h @@ -62,8 +62,10 @@ class FindFile { WIN32_FIND_DATA *a; WIN32_FIND_DATAW *w; HANDLE handle; + String pattern; - void Init(); + void Init(); + bool Next0(); public: bool Search(const char *name); diff --git a/uppsrc/CtrlCore/X11Clip.cpp b/uppsrc/CtrlCore/X11Clip.cpp index 612148bd0..aadbd061f 100644 --- a/uppsrc/CtrlCore/X11Clip.cpp +++ b/uppsrc/CtrlCore/X11Clip.cpp @@ -77,7 +77,7 @@ void Ctrl::Xclipboard::Request(XSelectionRequestEvent *se) LLOG("Request PRIMARY data " << XAtomName(se->target)); String fmt = XAtomName(se->target); int i = sel_formats.Find(fmt); - if(i >= 0) { + if(i >= 0 && sel_ctrl) { String d = sel_ctrl->GetSelectionData(fmt); XChangeProperty(Xdisplay, se->requestor, se->property, se->target, 8, PropModeReplace, d, d.GetLength()); diff --git a/uppsrc/ide/Help.cpp b/uppsrc/ide/Help.cpp index 16b6f0e14..5483cf00d 100644 --- a/uppsrc/ide/Help.cpp +++ b/uppsrc/ide/Help.cpp @@ -135,6 +135,7 @@ void TopicCtrl::ScanDirForTpp(const char *dir, Index& li, Vector& s VectorMap > >& map, const String& rel) { + DLOG("a"); TopicLink tl; for(FindFile pff(AppendFileName(dir, "*.*")); pff; pff.Next()) { if(pff.IsFolder() && *pff.GetName() != '.') { @@ -144,6 +145,7 @@ void TopicCtrl::ScanDirForTpp(const char *dir, Index& li, Vector& s if(ff.IsFolder()) { tl.group = GetFileTitle(ff.GetName()); String dir = AppendFileName(pdir, ff.GetName()); + DDUMP(dir); for(FindFile ft(AppendFileName(dir, "*.tpp")); ft; ft.Next()) if(ft.IsFile()) { tl.topic = GetFileTitle(ft.GetName()); @@ -154,15 +156,18 @@ void TopicCtrl::ScanDirForTpp(const char *dir, Index& li, Vector& s li.FindAdd(l); } String link = TopicLinkString(tl); + DDUMP(ft.GetName()); + DDUMP(link); if(idelink.Find(link) < 0 && MatchTopicLink(link, sdx) && (lng == "All" || lng == l)) { - map.GetAdd(tl.package).GetAdd(tl.group).Add(tl.topic); + map.GetAdd(tl.package).GetAdd(tl.group).GetAdd(tl.topic); } } } ScanDirForTpp(pdir, li, sdx, lng, map, tl.package + '/'); } } + DLOG("b"); } void TopicCtrl::SyncDocTree() @@ -226,6 +231,8 @@ void TopicCtrl::SyncDocTree() for(int i = 0; i < group.GetCount(); i++) { tl.topic = group[i]; String p = TopicLinkString(tl); + DUMP(tl.package); + DUMP(p); String t = GetTopicTitle(p); AddTree(gid, TopicImg::Topic(), p, t); }