From 4948ebf3ffe886443ec61bbecd1d0d3b794dfee2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 25 Jul 2006 00:33:14 +0000 Subject: [PATCH] handlers added using AddHandler() last must have the highest priority (patch 1522807) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40302 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/latex/wx/filesys.tex | 6 ++++-- src/common/filesys.cpp | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/latex/wx/filesys.tex b/docs/latex/wx/filesys.tex index 5f28f6f092..2d38e300a5 100644 --- a/docs/latex/wx/filesys.tex +++ b/docs/latex/wx/filesys.tex @@ -38,8 +38,10 @@ Constructor. \func{static void}{AddHandler}{\param{wxFileSystemHandler }{*handler}} -This static function adds new handler into the list of handlers. -The \helpref{handlers}{wxfilesystemhandler} provide access to virtual FS. +This static function adds new handler into the list of +\helpref{handlers}{wxfilesystemhandler} which provide access to virtual FS. +Note that if two handlers for the same protocol are added, the last one added +takes precedence. \wxheading{Note} diff --git a/src/common/filesys.cpp b/src/common/filesys.cpp index 5e99f9787a..44e265776b 100644 --- a/src/common/filesys.cpp +++ b/src/common/filesys.cpp @@ -482,7 +482,9 @@ bool wxFileSystem::FindFileInPath(wxString *pStr, void wxFileSystem::AddHandler(wxFileSystemHandler *handler) { - m_Handlers.Append(handler); + // prepend the handler to the beginning of the list because handlers added + // last should have the highest priority to allow overriding them + m_Handlers.Insert(0u, handler); } bool wxFileSystem::HasHandlerForPath(const wxString &location) -- 2.45.2