Fix file paths in wxFileSystemWatcherEvent under OS X.
The separator between the watched directory and the name of the file in the generated event was missing, add it now. Closes #13161. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67581 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -297,7 +297,8 @@ protected:
|
|||||||
while ( nflags )
|
while ( nflags )
|
||||||
{
|
{
|
||||||
// when monitoring dir, this means create/delete
|
// 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
|
// NOTE_LINK is set when the dir was created, but we
|
||||||
// don't care - we look for new names in directory
|
// don't care - we look for new names in directory
|
||||||
@@ -308,6 +309,7 @@ protected:
|
|||||||
wxArrayString changedFiles;
|
wxArrayString changedFiles;
|
||||||
wxArrayInt changedFlags;
|
wxArrayInt changedFlags;
|
||||||
FindChanges(w, changedFiles, changedFlags);
|
FindChanges(w, changedFiles, changedFlags);
|
||||||
|
|
||||||
wxArrayString::iterator it = changedFiles.begin();
|
wxArrayString::iterator it = changedFiles.begin();
|
||||||
wxArrayInt::iterator changeType = changedFlags.begin();
|
wxArrayInt::iterator changeType = changedFlags.begin();
|
||||||
for ( ; it != changedFiles.end(); ++it, ++changeType )
|
for ( ; it != changedFiles.end(); ++it, ++changeType )
|
||||||
@@ -315,11 +317,13 @@ protected:
|
|||||||
wxFileName path;
|
wxFileName path;
|
||||||
if ( wxDirExists(*it) )
|
if ( wxDirExists(*it) )
|
||||||
{
|
{
|
||||||
path = wxFileName::DirName(w.GetPath() + *it);
|
path = wxFileName::DirName(
|
||||||
|
basepath + wxFileName::GetPathSeparator() + *it
|
||||||
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
path = wxFileName::FileName(w.GetPath() + *it);
|
path.Assign(basepath, *it);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFileSystemWatcherEvent event(*changeType, path, path);
|
wxFileSystemWatcherEvent event(*changeType, path, path);
|
||||||
@@ -333,28 +337,28 @@ protected:
|
|||||||
// still we couldn't be sure we have the right name...
|
// still we couldn't be sure we have the right name...
|
||||||
nflags &= ~NOTE_RENAME;
|
nflags &= ~NOTE_RENAME;
|
||||||
wxFileSystemWatcherEvent event(wxFSW_EVENT_RENAME,
|
wxFileSystemWatcherEvent event(wxFSW_EVENT_RENAME,
|
||||||
w.GetPath(), wxFileName());
|
basepath, wxFileName());
|
||||||
SendEvent(event);
|
SendEvent(event);
|
||||||
}
|
}
|
||||||
else if ( nflags & NOTE_WRITE || nflags & NOTE_EXTEND )
|
else if ( nflags & NOTE_WRITE || nflags & NOTE_EXTEND )
|
||||||
{
|
{
|
||||||
nflags &= ~(NOTE_WRITE | NOTE_EXTEND);
|
nflags &= ~(NOTE_WRITE | NOTE_EXTEND);
|
||||||
wxFileSystemWatcherEvent event(wxFSW_EVENT_MODIFY,
|
wxFileSystemWatcherEvent event(wxFSW_EVENT_MODIFY,
|
||||||
w.GetPath(), w.GetPath());
|
basepath, basepath);
|
||||||
SendEvent(event);
|
SendEvent(event);
|
||||||
}
|
}
|
||||||
else if ( nflags & NOTE_DELETE )
|
else if ( nflags & NOTE_DELETE )
|
||||||
{
|
{
|
||||||
nflags &= ~(NOTE_DELETE);
|
nflags &= ~(NOTE_DELETE);
|
||||||
wxFileSystemWatcherEvent event(wxFSW_EVENT_DELETE,
|
wxFileSystemWatcherEvent event(wxFSW_EVENT_DELETE,
|
||||||
w.GetPath(), w.GetPath());
|
basepath, basepath);
|
||||||
SendEvent(event);
|
SendEvent(event);
|
||||||
}
|
}
|
||||||
else if ( nflags & NOTE_ATTRIB )
|
else if ( nflags & NOTE_ATTRIB )
|
||||||
{
|
{
|
||||||
nflags &= ~(NOTE_ATTRIB);
|
nflags &= ~(NOTE_ATTRIB);
|
||||||
wxFileSystemWatcherEvent event(wxFSW_EVENT_ACCESS,
|
wxFileSystemWatcherEvent event(wxFSW_EVENT_ACCESS,
|
||||||
w.GetPath(), w.GetPath());
|
basepath, basepath);
|
||||||
SendEvent(event);
|
SendEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user