]> git.saurik.com Git - wxWidgets.git/commitdiff
Correct wxDirExists() check in OS X wxFileSystemWatcher implementation.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 3 May 2011 10:40:28 +0000 (10:40 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 3 May 2011 10:40:28 +0000 (10:40 +0000)
Pass the full path to wxDirExists, not the relative path from the watched
directory as this won't work unless the watched directory is the same as the
current one.

Closes #13161.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67677 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/unix/fswatcher_kqueue.cpp

index 41ecbdede7940f9d25653534e3027aa075455625..5229e5139bd6b4d44a5505b7cb088190ae88dded 100644 (file)
@@ -314,17 +314,12 @@ protected:
                 wxArrayInt::iterator changeType = changedFlags.begin();
                 for ( ; it != changedFiles.end(); ++it, ++changeType )
                 {
-                    wxFileName path;
-                    if ( wxDirExists(*it) )
-                    {
-                        path = wxFileName::DirName(
-                                basepath + wxFileName::GetPathSeparator() + *it
-                               );
-                    }
-                    else
-                    {
-                        path.Assign(basepath, *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);