diff --git a/qrenderdoc/Code/Interface/PersistantConfig.cpp b/qrenderdoc/Code/Interface/PersistantConfig.cpp index 2893fecdb..600a01e41 100644 --- a/qrenderdoc/Code/Interface/PersistantConfig.cpp +++ b/qrenderdoc/Code/Interface/PersistantConfig.cpp @@ -655,7 +655,7 @@ void AddRecentFile(rdcarray &recentList, const rdcstr &file) return; } - if(recentList.contains(path)) + if(recentList.contains(rdcstr(path))) recentList.removeOne(path); recentList.push_back(path); diff --git a/renderdoc/api/replay/rdcarray.h b/renderdoc/api/replay/rdcarray.h index 61e6828fe..cb4570a6f 100644 --- a/renderdoc/api/replay/rdcarray.h +++ b/renderdoc/api/replay/rdcarray.h @@ -638,8 +638,25 @@ public: return -1; } + template + int32_t indexOf(const U &el, size_t first = 0, size_t last = ~0U) const + { + for(size_t i = first; i < usedCount && i < last; i++) + { + if(elems[i] == el) + return (int32_t)i; + } + + return -1; + } + // return true if an element is found bool contains(const T &el) const { return indexOf(el) != -1; } + template + bool contains(const U &el) const + { + return indexOf(el) != -1; + } // remove the first occurrence of an element void removeOne(const T &el) {