X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6b8ef0b35d674bc262eb2005ac1321762c831d31..08670ea85abf4b4946a9ce64971b591d7b1ee30b:/src/common/fswatchercmn.cpp diff --git a/src/common/fswatchercmn.cpp b/src/common/fswatchercmn.cpp index 295f7a105e..73a608c450 100644 --- a/src/common/fswatchercmn.cpp +++ b/src/common/fswatchercmn.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: common/fswatchercmn.cpp +// Name: src/common/fswatchercmn.cpp // Purpose: wxMswFileSystemWatcher // Author: Bartosz Bekier // Created: 2009-05-26 @@ -79,10 +79,30 @@ wxFileSystemWatcherBase::~wxFileSystemWatcherBase() bool wxFileSystemWatcherBase::Add(const wxFileName& path, int events) { - // args validation & consistency checks - if (!path.FileExists() && !path.DirExists()) + wxFSWPathType type = wxFSWPath_None; + if ( path.FileExists() ) + { + type = wxFSWPath_File; + } + else if ( path.DirExists() ) + { + type = wxFSWPath_Dir; + } + else + { + wxLogError(_("Can't monitor non-existent path \"%s\" for changes."), + path.GetFullPath()); return false; + } + return DoAdd(path, events, type); +} + +bool +wxFileSystemWatcherBase::DoAdd(const wxFileName& path, + int events, + wxFSWPathType type) +{ wxString canonical = GetCanonicalPath(path); if (canonical.IsEmpty()) return false; @@ -91,7 +111,7 @@ bool wxFileSystemWatcherBase::Add(const wxFileName& path, int events) wxString::Format("Path '%s' is already watched", canonical)); // adding a path in a platform specific way - wxFSWatchInfo watch(canonical, events); + wxFSWatchInfo watch(canonical, events, type); if ( !m_service->Add(watch) ) return false;