]> git.saurik.com Git - wxWidgets.git/blobdiff - src/unix/fswatcher_kqueue.cpp
Rename delegates to try and stop name clashes, probably with wxWebKitCtrl.
[wxWidgets.git] / src / unix / fswatcher_kqueue.cpp
index 2c7296a4e0c617be8cb2237d9d531f704f6f064c..5229e5139bd6b4d44a5505b7cb088190ae88dded 100644 (file)
@@ -297,7 +297,8 @@ protected:
         while ( nflags )
         {
             // when monitoring dir, this means create/delete
-            if ( nflags & NOTE_WRITE && wxDirExists(w.GetPath()) )
+            const wxString basepath = w.GetPath();
+            if ( nflags & NOTE_WRITE && wxDirExists(basepath) )
             {
                 // NOTE_LINK is set when the dir was created, but we
                 // don't care - we look for new names in directory
@@ -308,19 +309,17 @@ protected:
                 wxArrayString changedFiles;
                 wxArrayInt changedFlags;
                 FindChanges(w, changedFiles, changedFlags);
+
                 wxArrayString::iterator it = changedFiles.begin();
                 wxArrayInt::iterator changeType = changedFlags.begin();
                 for ( ; it != changedFiles.end(); ++it, ++changeType )
                 {
-                    wxFileName path;
-                    if ( wxDirExists(*it) )
-                    {
-                        path = wxFileName::DirName(w.GetPath() + *it);
-                    }
-                    else
-                    {
-                        path = wxFileName::FileName(w.GetPath() + *it);
-                    }
+                    const wxString fullpath = w.GetPath() +
+                                                wxFileName::GetPathSeparator() +
+                                                  *it;
+                    const wxFileName path(wxDirExists(fullpath)
+                                            ? wxFileName::DirName(fullpath)
+                                            : wxFileName::FileName(fullpath));
 
                     wxFileSystemWatcherEvent event(*changeType, path, path);
                     SendEvent(event);
@@ -333,28 +332,28 @@ protected:
                 // still we couldn't be sure we have the right name...
                 nflags &= ~NOTE_RENAME;
                 wxFileSystemWatcherEvent event(wxFSW_EVENT_RENAME,
-                                        w.GetPath(), wxFileName());
+                                        basepath, wxFileName());
                 SendEvent(event);
             }
             else if ( nflags & NOTE_WRITE || nflags & NOTE_EXTEND )
             {
                 nflags &= ~(NOTE_WRITE | NOTE_EXTEND);
                 wxFileSystemWatcherEvent event(wxFSW_EVENT_MODIFY,
-                                        w.GetPath(), w.GetPath());
+                                        basepath, basepath);
                 SendEvent(event);
             }
             else if ( nflags & NOTE_DELETE )
             {
                 nflags &= ~(NOTE_DELETE);
                 wxFileSystemWatcherEvent event(wxFSW_EVENT_DELETE,
-                                        w.GetPath(), w.GetPath());
+                                        basepath, basepath);
                 SendEvent(event);
             }
             else if ( nflags & NOTE_ATTRIB )
             {
                 nflags &= ~(NOTE_ATTRIB);
                 wxFileSystemWatcherEvent event(wxFSW_EVENT_ACCESS,
-                                        w.GetPath(), w.GetPath());
+                                        basepath, basepath);
                 SendEvent(event);
             }