]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/fswatchercmn.cpp
Ensure we pass the correct type of string to EscapeFileNameCharsInURL in wxWebViewArc...
[wxWidgets.git] / src / common / fswatchercmn.cpp
index 295f7a105edeb9bac204becc292ce5f4307500b3..73a608c45090781678a85ba4c7ac5b9442f71a13 100644 (file)
@@ -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;