// Purpose: kqueue-based wxFileSystemWatcher implementation
// Author: Bartosz Bekier
// Created: 2009-05-26
-// RCS-ID: $Id$
// Copyright: (c) 2009 Bartosz Bekier <bartosz.bekier@gmail.com>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// TODO more error conditions according to man
// XXX closing file descriptor removes the watch. The logic resides in
// the watch which is not nice, but effective and simple
- bool ret = watch->Close();
- if (ret == -1)
+ if ( !watch->Close() )
{
wxLogSysError(_("Unable to remove kqueue watch"));
return false;
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);