From 5876ad8acc9fff284ae0636c522d1fbab595634d Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Fri, 27 Feb 2009 21:49:31 +0000 Subject: [PATCH] (trunk daemon) experimental commit for part of #1483: adding a WatchDir to transmission-daemon. I don't know if this will work out because of (1) any possible C/C++ issues, and (2) maybe some embedded systems don't have inotify and/or kqueue? --- configure.ac | 1 + daemon/Makefile.am | 1 + daemon/daemon.c | 53 +- daemon/transmission-daemon.1 | 9 + third-party/Makefile.am | 1 + third-party/filewatcher/FileWatcher.cpp | 62 +++ third-party/filewatcher/FileWatcher.h | 111 ++++ third-party/filewatcher/FileWatcherLinux.cpp | 166 ++++++ third-party/filewatcher/FileWatcherLinux.h | 76 +++ third-party/filewatcher/FileWatcherOSX.cpp | 132 +++++ third-party/filewatcher/FileWatcherOSX.h | 76 +++ third-party/filewatcher/FileWatcherWin32.cpp | 243 ++++++++ third-party/filewatcher/FileWatcherWin32.h | 73 +++ third-party/filewatcher/License.txt | 20 + third-party/filewatcher/Makefile | 551 +++++++++++++++++++ third-party/filewatcher/Makefile.am | 22 + third-party/filewatcher/Makefile.in | 551 +++++++++++++++++++ third-party/filewatcher/README | 5 + third-party/filewatcher/ReadMe.txt | 27 + third-party/filewatcher/file-watcher.cpp | 61 ++ third-party/filewatcher/file-watcher.h | 44 ++ third-party/filewatcher/makelog | 16 + 22 files changed, 2298 insertions(+), 3 deletions(-) create mode 100644 third-party/filewatcher/FileWatcher.cpp create mode 100644 third-party/filewatcher/FileWatcher.h create mode 100644 third-party/filewatcher/FileWatcherLinux.cpp create mode 100644 third-party/filewatcher/FileWatcherLinux.h create mode 100644 third-party/filewatcher/FileWatcherOSX.cpp create mode 100644 third-party/filewatcher/FileWatcherOSX.h create mode 100644 third-party/filewatcher/FileWatcherWin32.cpp create mode 100644 third-party/filewatcher/FileWatcherWin32.h create mode 100644 third-party/filewatcher/License.txt create mode 100644 third-party/filewatcher/Makefile create mode 100644 third-party/filewatcher/Makefile.am create mode 100644 third-party/filewatcher/Makefile.in create mode 100644 third-party/filewatcher/README create mode 100644 third-party/filewatcher/ReadMe.txt create mode 100644 third-party/filewatcher/file-watcher.cpp create mode 100644 third-party/filewatcher/file-watcher.h create mode 100644 third-party/filewatcher/makelog diff --git a/configure.ac b/configure.ac index 1c829769d..7389f4706 100644 --- a/configure.ac +++ b/configure.ac @@ -337,6 +337,7 @@ AC_CONFIG_FILES([Makefile doc/Makefile libtransmission/Makefile third-party/Makefile + third-party/filewatcher/Makefile third-party/miniupnp/Makefile third-party/libnatpmp/Makefile macosx/Makefile diff --git a/daemon/Makefile.am b/daemon/Makefile.am index 381142ba5..b189be61a 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -19,6 +19,7 @@ bin_PROGRAMS = \ LDADD = \ $(top_builddir)/libtransmission/libtransmission.a \ + $(top_builddir)/third-party/filewatcher/libfilewatcher.a -lstdc++ \ $(top_builddir)/third-party/miniupnp/libminiupnp.a \ $(top_builddir)/third-party/libnatpmp/libnatpmp.a \ $(top_builddir)/third-party/libevent/libevent.la \ diff --git a/daemon/daemon.c b/daemon/daemon.c index 212f92c49..5d1edb674 100644 --- a/daemon/daemon.c +++ b/daemon/daemon.c @@ -31,8 +31,14 @@ #include #include +#include + #define MY_NAME "transmission-daemon" +#define PREF_KEY_DIR_WATCH "watch-dir" +#define PREF_KEY_DIR_WATCH_ENABLED "watch-dir-enabled" + + static int closing = FALSE; static tr_session * mySession = NULL; @@ -58,6 +64,8 @@ static const struct tr_option options[] = { 'a', "allowed", "Allowed IP addresses. (Default: " TR_DEFAULT_RPC_WHITELIST ")", "a", 1, "" }, { 'b', "blocklist", "Enable peer blocklists", "b", 0, NULL }, { 'B', "no-blocklist", "Disable peer blocklists", "B", 0, NULL }, + { 'c', "watch-dir", "Directory to watch for new .torrent files", "c", 1, "" }, + { 'C', "no-watch-dir", "Disable the watch-dir", "C", 0, NULL }, { 'd', "dump-settings", "Dump the settings and exit", "d", 0, NULL }, { 'f', "foreground", "Run in the foreground instead of daemonizing", "f", 0, NULL }, { 'g', "config-dir", "Where to look for configuration files", "g", 1, "" }, @@ -172,10 +180,23 @@ getConfigDir( int argc, const char ** argv ) return configDir; } +static void +dirChangedCB( CFW_Watch * watch UNUSED, const char * directory, const char * filename, CFW_Action action, void * userData ) +{ + if( action & ( CFW_ACTION_ADD | CFW_ACTION_DELETE ) ) + { + int err; + char * path = tr_buildPath( directory, filename, NULL ); + tr_session * session = userData; + tr_ctor * ctor = tr_ctorNew( session ); + tr_ctorSetMetainfoFromFile( ctor, path ); + tr_torrentNew( session, ctor, &err ); + tr_free( path ); + } +} int -main( int argc, - char ** argv ) +main( int argc, char ** argv ) { int c; int64_t i; @@ -184,6 +205,7 @@ main( int argc, tr_bool foreground = FALSE; tr_bool dumpSettings = FALSE; const char * configDir = NULL; + CFW_Watch * watch = NULL; signal( SIGINT, gotsig ); signal( SIGTERM, gotsig ); @@ -210,6 +232,11 @@ main( int argc, break; case 'B': tr_bencDictAddInt( &settings, TR_PREFS_KEY_BLOCKLIST_ENABLED, 0 ); break; + case 'c': tr_bencDictAddStr( &settings, PREF_KEY_DIR_WATCH, optarg ); + tr_bencDictAddInt( &settings, PREF_KEY_DIR_WATCH_ENABLED, 1 ); + break; + case 'C': tr_bencDictAddInt( &settings, PREF_KEY_DIR_WATCH_ENABLED, 0 ); + break; case 'd': dumpSettings = TRUE; break; case 'f': foreground = TRUE; @@ -275,6 +302,21 @@ main( int argc, if( tr_bencDictFindInt( &settings, TR_PREFS_KEY_RPC_AUTH_REQUIRED, &i ) && i!=0 ) tr_ninf( MY_NAME, "requiring authentication" ); + /* maybe add a watchdir */ + { + int64_t doWatch; + const char * watchDir; + if( tr_bencDictFindInt( &settings, PREF_KEY_DIR_WATCH_ENABLED, &doWatch ) + && doWatch + && tr_bencDictFindStr( &settings, PREF_KEY_DIR_WATCH, &watchDir ) + && watchDir + && *watchDir ) + { + tr_ninf( MY_NAME, "watching \"%s\" for added .torrent files", watchDir ); + watch = cfw_addWatch( watchDir, dirChangedCB, mySession ); + } + } + /* load the torrents */ { tr_ctor * ctor = tr_ctorNew( mySession ); @@ -283,11 +325,16 @@ main( int argc, tr_ctorFree( ctor ); } - while( !closing ) + while( !closing ) { tr_wait( 1000 ); /* sleep one second */ + if( watch ) + cfw_update( watch ); + } /* shutdown */ printf( "Closing transmission session..." ); + if( watch ) + cfw_removeWatch( watch ); tr_sessionSaveSettings( mySession, configDir, &settings ); tr_sessionClose( mySession ); printf( " done.\n" ); diff --git a/daemon/transmission-daemon.1 b/daemon/transmission-daemon.1 index 74d302bfb..b4ee36734 100644 --- a/daemon/transmission-daemon.1 +++ b/daemon/transmission-daemon.1 @@ -11,6 +11,8 @@ .Nm .Op Fl a Ar x.x.x.x,... .Op Fl b | B +.Op Fl c Ar directory +.Op Fl C .Op Fl f .Op Fl g Ar directory .Op Fl h @@ -46,6 +48,13 @@ Example: "127.0.0.*,192.168.1.*" Enable peer blocklists. Transmission understands the bluetack blocklist file format. New blocklists can be added by copying them into the config-dir's "blocklists" subdirectory. +.It Fl c Ar directory +Directory to watch for new .torrent files to be added. As they are added to this directory, +the daemon will load them into Transmission. + +.It Fl C +Do not watch for new .torrent files. + .It Fl B Fl -no-blocklist Disble blocklists. diff --git a/third-party/Makefile.am b/third-party/Makefile.am index 4d9e661c3..fd6ea2215 100644 --- a/third-party/Makefile.am +++ b/third-party/Makefile.am @@ -1,4 +1,5 @@ SUBDIRS = \ + filewatcher \ libevent \ libnatpmp \ miniupnp diff --git a/third-party/filewatcher/FileWatcher.cpp b/third-party/filewatcher/FileWatcher.cpp new file mode 100644 index 000000000..b380f90e3 --- /dev/null +++ b/third-party/filewatcher/FileWatcher.cpp @@ -0,0 +1,62 @@ +/** + Released under a free dont-bother-me license. I don't claim this + software won't destroy everything that you hold dear, but I really + doubt it will. And please try not to take credit for others' work. + + @author James Wynn + @date 4/15/2009 +*/ + +#include "FileWatcher.h" + +#if defined(_WIN32) +# include "FileWatcherWin32.h" +#elif defined(__APPLE_CC__) +# include "FileWatcherOSX.h" +#elif defined(__linux__) +# include "FileWatcherLinux.h" +#else +# error FIXME +#endif + +namespace FW +{ + + //-------- + FileWatcher::FileWatcher() + { + mImpl = new FileWatcherImpl(); + } + + //-------- + FileWatcher::~FileWatcher() + { + delete mImpl; + mImpl = 0; + } + + //-------- + WatchID FileWatcher::addWatch(const String& directory, FileWatchListener* watcher) + { + return mImpl->addWatch(directory, watcher); + } + + //-------- + void FileWatcher::removeWatch(const String& directory) + { + mImpl->removeWatch(directory); + } + + //-------- + void FileWatcher::removeWatch(WatchID watchid) + { + mImpl->removeWatch(watchid); + } + + //-------- + void FileWatcher::update() + { + mImpl->update(); + } + +};//namespace FW diff --git a/third-party/filewatcher/FileWatcher.h b/third-party/filewatcher/FileWatcher.h new file mode 100644 index 000000000..444b2cfb6 --- /dev/null +++ b/third-party/filewatcher/FileWatcher.h @@ -0,0 +1,111 @@ +/** + Released under a free dont-bother-me license. I don't claim this + software won't destroy everything that you hold dear, but I really + doubt it will. And please try not to take credit for others' work. + + @author James Wynn + @date 4/15/2009 +*/ + +/** + Main header for the FileWatcher class. Declares all implementation + classes to reduce compilation overhead. +*/ + +#ifndef _FW_FILEWATCHER_H_ +#define _FW_FILEWATCHER_H_ +#pragma once + +#include + +namespace FW +{ + /// Type for a string + typedef std::string String; + /// Type for a watch id + typedef unsigned long WatchID; + + // forward decl + class FileWatchListener; + class FileWatcher32; + class FileWatcherLinux; + class FileWatcherOSX; + + +#if defined(_WIN32) + typedef class FileWatcherWin32 FileWatcherImpl; +#elif defined(__APPLE_CC__) + typedef FileWatcherOSX FileWatcherImpl; +#elif defined(__linux__) + typedef class FileWatcherLinux FileWatcherImpl; +#endif + + /// Listens to files and directories and dispatches events + /// to notify the parent program of the changes. + /// @class FileWatcher + class FileWatcher + { + public: + + public: + /// Actions to listen for. Rename will send two events, one for + /// the deletion of the old file, and one for the creation of the + /// new file. + enum Action + { + /// Sent when a file is created or renamed + ACTION_ADD = 1, + /// Sent when a file is deleted or renamed + ACTION_DELETE = 2, + /// Sent when a file is modified + ACTION_MODIFIED = 4 + }; + + public: + /// + /// + FileWatcher(); + + /// + /// + virtual ~FileWatcher(); + + /// Add a directory watch + WatchID addWatch(const String& directory, FileWatchListener* watcher); + + /// Remove a directory watch. This is a brute force search O(nlogn). + void removeWatch(const String& directory); + + /// Remove a directory watch. This is a map lookup O(logn). + void removeWatch(WatchID watchid); + + /// Updates the watcher. Must be called often. + void update(); + + private: + /// The implementation + FileWatcherImpl* mImpl; + + };//end FileWatcher + + + /// Basic interface for listening for file events. + /// @class FileWatchListener + class FileWatchListener + { + public: + FileWatchListener() {} + virtual ~FileWatchListener() {} + + /// Handles the action file action + /// @param watchid The watch id for the directory + /// @param dir The directory + /// @param filename The filename that was accessed (not full path) + /// @param action Action that was performed + virtual void handleFileAction(WatchID watchid, const String& dir, const String& filename, FileWatcher::Action action) = 0; + + };//class FileWatchListener + +};//namespace FW + +#endif//_FW_FILEWATCHER_H_ diff --git a/third-party/filewatcher/FileWatcherLinux.cpp b/third-party/filewatcher/FileWatcherLinux.cpp new file mode 100644 index 000000000..f14af37a3 --- /dev/null +++ b/third-party/filewatcher/FileWatcherLinux.cpp @@ -0,0 +1,166 @@ +/** + Released under a free dont-bother-me license. I don't claim this + software won't destroy everything that you hold dear, but I really + doubt it will. And please try not to take credit for others' work. + + @author James Wynn + @date 4/15/2009 +*/ + +#ifdef __linux__ + +#include "FileWatcherLinux.h" + +#include +#include +#include +#include +#include +#include + +#define BUFF_SIZE ((sizeof(struct inotify_event)+FILENAME_MAX)*1024) + +namespace FW +{ + + struct WatchStruct + { + WatchID mWatchID; + String mDirName; + FileWatchListener* mListener; + }; + + //-------- + FileWatcherLinux::FileWatcherLinux() + { + mFD = inotify_init(); + if (mFD < 0) + fprintf (stderr, "Error: %s\n", strerror(errno)); + + mTimeOut.tv_sec = 0; + mTimeOut.tv_usec = 0; + + FD_ZERO(&mDescriptorSet); + } + + //-------- + FileWatcherLinux::~FileWatcherLinux() + { + WatchMap::iterator iter = mWatches.begin(); + WatchMap::iterator end = mWatches.end(); + for(; iter != end; ++iter) + { + delete iter->second; + } + mWatches.clear(); + } + + //-------- + WatchID FileWatcherLinux::addWatch(const String& directory, FileWatchListener* watcher) + { + int wd = inotify_add_watch (mFD, directory.c_str(), + IN_CLOSE_WRITE | IN_MOVED_TO | IN_CREATE | IN_MOVED_FROM | IN_DELETE); + if (wd < 0) + { + fprintf (stderr, "Error: %s\n", strerror(errno)); + return -1; + } + + WatchStruct* pWatch = new WatchStruct(); + pWatch->mListener = watcher; + pWatch->mWatchID = wd; + pWatch->mDirName = directory; + + mWatches.insert(std::make_pair(wd, pWatch)); + + return wd; + } + + //-------- + void FileWatcherLinux::removeWatch(const String& directory) + { + WatchMap::iterator iter = mWatches.begin(); + WatchMap::iterator end = mWatches.end(); + for(; iter != end; ++iter) + { + if(directory == iter->second->mDirName) + { + removeWatch(iter->first); + return; + } + } + } + + //-------- + void FileWatcherLinux::removeWatch(WatchID watchid) + { + WatchMap::iterator iter = mWatches.find(watchid); + + if(iter == mWatches.end()) + return; + + WatchStruct* watch = iter->second; + mWatches.erase(iter); + + inotify_rm_watch(mFD, watchid); + + delete watch; + watch = 0; + } + + //-------- + void FileWatcherLinux::update() + { + FD_SET(mFD, &mDescriptorSet); + + int ret = select(mFD + 1, &mDescriptorSet, NULL, NULL, &mTimeOut); + if(ret < 0) + { + perror("select"); + } + else if(FD_ISSET(mFD, &mDescriptorSet)) + { + ssize_t len, i = 0; + char action[81+FILENAME_MAX] = {0}; + char buff[BUFF_SIZE] = {0}; + + len = read (mFD, buff, BUFF_SIZE); + + while (i < len) + { + struct inotify_event *pevent = (struct inotify_event *)&buff[i]; + + WatchStruct* watch = mWatches[pevent->wd]; + handleAction(watch, pevent->name, pevent->mask); + i += sizeof(struct inotify_event) + pevent->len; + } + } + } + + //-------- + void FileWatcherLinux::handleAction(WatchStruct* watch, const String& filename, unsigned long action) + { + if(!watch->mListener) + return; + + if(IN_CLOSE_WRITE & action) + { + watch->mListener->handleFileAction(watch->mWatchID, watch->mDirName, filename, + FileWatcher::ACTION_MODIFIED); + } + if(IN_MOVED_TO & action || IN_CREATE & action) + { + watch->mListener->handleFileAction(watch->mWatchID, watch->mDirName, filename, + FileWatcher::ACTION_ADD); + } + if(IN_MOVED_FROM & action || IN_DELETE & action) + { + watch->mListener->handleFileAction(watch->mWatchID, watch->mDirName, filename, + FileWatcher::ACTION_DELETE); + } + } + +};//namespace FW + + +#endif//__linux__ diff --git a/third-party/filewatcher/FileWatcherLinux.h b/third-party/filewatcher/FileWatcherLinux.h new file mode 100644 index 000000000..5c446f636 --- /dev/null +++ b/third-party/filewatcher/FileWatcherLinux.h @@ -0,0 +1,76 @@ +/** + Released under a free dont-bother-me license. I don't claim this + software won't destroy everything that you hold dear, but I really + doubt it will. And please try not to take credit for others' work. + + @author James Wynn + @date 4/15/2009 +*/ + +/** + Implementation header file for Linux based on inotify. +*/ + +#ifndef _FW_FILEWATCHERLINUX_H_ +#define _FW_FILEWATCHERLINUX_H_ +#pragma once + +#include "FileWatcher.h" +#include +#include + +namespace FW +{ + + // forward decl + struct WatchStruct; + + /// + /// @class FileWatcherLinux + class FileWatcherLinux + { + public: + /// type for a map from WatchID to WatchStruct pointer + typedef std::map WatchMap; + + public: + /// + /// + FileWatcherLinux(); + + /// + /// + virtual ~FileWatcherLinux(); + + /// Add a directory watch + WatchID addWatch(const String& directory, FileWatchListener* watcher); + + /// Remove a directory watch. This is a brute force lazy search O(nlogn). + void removeWatch(const String& directory); + + /// Remove a directory watch. This is a map lookup O(logn). + void removeWatch(WatchID watchid); + + /// Updates the watcher. Must be called often. + void update(); + + /// Handles the action + void handleAction(WatchStruct* watch, const String& filename, unsigned long action); + + private: + /// Map of WatchID to WatchStruct pointers + WatchMap mWatches; + /// The last watchid + WatchID mLastWatchID; + /// inotify file descriptor + int mFD; + /// time out data + struct timeval mTimeOut; + /// File descriptor set + fd_set mDescriptorSet; + + };//end FileWatcherLinux + +};//namespace FW + +#endif//_FW_FILEWATCHERLINUX_H_ diff --git a/third-party/filewatcher/FileWatcherOSX.cpp b/third-party/filewatcher/FileWatcherOSX.cpp new file mode 100644 index 000000000..4a4c5a04a --- /dev/null +++ b/third-party/filewatcher/FileWatcherOSX.cpp @@ -0,0 +1,132 @@ +/** + Released under a free dont-bother-me license. I don't claim this + software won't destroy everything that you hold dear, but I really + doubt it will. And please try not to take credit for others' work. + + @author James Wynn + @date 4/15/2009 +*/ + +#ifdef __APPLE_CC__ + +#include "FileWatcherOSX.h" + +#include +#include +#include +#include +#include + + +namespace FW +{ + + struct kevent change; + struct kevent event; + + struct WatchStruct + { + WatchID mWatchID; + String mDirName; + FileWatchListener* mListener; + }; + + //-------- + FileWatcherOSX::FileWatcherOSX() + { + mDescriptor = kqueue(); + mTimeOut.tv_sec = 0; + mTimeOut.tv_nsec = 0; + } + + //-------- + FileWatcherOSX::~FileWatcherOSX() + { + WatchMap::iterator iter = mWatches.begin(); + WatchMap::iterator end = mWatches.end(); + for(; iter != end; ++iter) + { + delete iter->second; + } + mWatches.clear(); + + close(mDescriptor); + } + + //-------- + WatchID FileWatcherOSX::addWatch(const String& directory, FileWatchListener* watcher) + { + int fd = open(directory.c_str(), O_RDONLY); + if(fd == -1) + perror("open"); + + EV_SET(&change, fd, EVFILT_VNODE, + EV_ADD | EV_ENABLE | EV_ONESHOT, + NOTE_DELETE | NOTE_EXTEND | NOTE_WRITE | NOTE_ATTRIB, + 0, (void*)"testing"); + + return 0; + } + + //-------- + void FileWatcherOSX::removeWatch(const String& directory) + { + WatchMap::iterator iter = mWatches.begin(); + WatchMap::iterator end = mWatches.end(); + for(; iter != end; ++iter) + { + if(directory == iter->second->mDirName) + { + removeWatch(iter->first); + return; + } + } + } + + //-------- + void FileWatcherOSX::removeWatch(WatchID watchid) + { + WatchMap::iterator iter = mWatches.find(watchid); + + if(iter == mWatches.end()) + return; + + WatchStruct* watch = iter->second; + mWatches.erase(iter); + + //inotify_rm_watch(mFD, watchid); + + delete watch; + watch = 0; + } + + //-------- + void FileWatcherOSX::update() + { + int nev = kevent(mDescriptor, &change, 1, &event, 1, &mTimeOut); + + if(nev == -1) + perror("kevent"); + else if (nev > 0) + { + printf("File: %s -- ", (char*)event.udata); + if(event.fflags & NOTE_DELETE) + { + printf("File deleted\n"); + } + if(event.fflags & NOTE_EXTEND || + event.fflags & NOTE_WRITE) + printf("File modified\n"); + if(event.fflags & NOTE_ATTRIB) + printf("File attributes modified\n"); + } + } + + //-------- + void FileWatcherOSX::handleAction(WatchStruct* watch, const String& filename, unsigned long action) + { + } + +};//namespace FW + +#endif//__APPLE_CC__ diff --git a/third-party/filewatcher/FileWatcherOSX.h b/third-party/filewatcher/FileWatcherOSX.h new file mode 100644 index 000000000..719ea87c3 --- /dev/null +++ b/third-party/filewatcher/FileWatcherOSX.h @@ -0,0 +1,76 @@ +/** + Released under a free dont-bother-me license. I don't claim this + software won't destroy everything that you hold dear, but I really + doubt it will. And please try not to take credit for others' work. + + @author James Wynn + @date 4/15/2009 +*/ + +/** + Implementation header file for OSX based on FSEvent. +*/ + +#ifndef _FW_FILEWATCHEROSX_H_ +#define _FW_FILEWATCHEROSX_H_ +#pragma once + +#ifdef __APPLE_CC__ + +#include "FileWatcher.h" +#include +#include + +namespace FW +{ + + // forward decl + struct WatchStruct; + + /// + /// @class FileWatcherOSX + class FileWatcherOSX + { + public: + /// type for a map from WatchID to WatchStruct pointer + typedef std::map WatchMap; + + public: + /// + /// + FileWatcherOSX(); + + /// + /// + virtual ~FileWatcherOSX(); + + /// Add a directory watch + WatchID addWatch(const String& directory, FileWatchListener* watcher); + + /// Remove a directory watch. This is a brute force lazy search O(nlogn). + void removeWatch(const String& directory); + + /// Remove a directory watch. This is a map lookup O(logn). + void removeWatch(WatchID watchid); + + /// Updates the watcher. Must be called often. + void update(); + + /// Handles the action + void handleAction(WatchStruct* watch, const String& filename, unsigned long action); + + private: + /// Map of WatchID to WatchStruct pointers + WatchMap mWatches; + /// The descriptor for the kqueue + int mDescriptor; + /// time out data + struct timespec mTimeOut; + + };//end FileWatcherOSX + +};//namespace FW + +#endif//__APPLE_CC__ + +#endif//_FW_FILEWATCHEROSX_H_ diff --git a/third-party/filewatcher/FileWatcherWin32.cpp b/third-party/filewatcher/FileWatcherWin32.cpp new file mode 100644 index 000000000..c3a2cb7c4 --- /dev/null +++ b/third-party/filewatcher/FileWatcherWin32.cpp @@ -0,0 +1,243 @@ +/** + Released under a free dont-bother-me license. I don't claim this + software won't destroy everything that you hold dear, but I really + doubt it will. And please try not to take credit for others' work. + + @author James Wynn + @date 4/15/2009 +*/ + +#ifdef _WIN32 + +#include "FileWatcherWin32.h" + +#define _WIN32_WINNT 0x0550 +#include + +#if defined(_MSC_VER) +#pragma comment(lib, "comctl32.lib") +#pragma comment(lib, "user32.lib") +#pragma comment(lib, "ole32.lib") +#endif + +namespace FW +{ + /// Internal watch data + struct WatchStruct + { + OVERLAPPED mOverlapped; + HANDLE mDirHandle; + BYTE mBuffer[32 * 1024]; + LPARAM lParam; + DWORD mNotifyFilter; + bool mStopNow; + FileWatcherImpl* mFileWatcher; + FileWatchListener* mFileWatchListener; + char* mDirName; + WatchID mWatchid; + }; + +#pragma region Internal Functions + + // forward decl + bool RefreshWatch(WatchStruct* pWatch); + + /// Unpacks events and passes them to a user defined callback. + void CALLBACK WatchCallback(DWORD dwErrorCode, DWORD dwNumberOfBytesTransfered, LPOVERLAPPED lpOverlapped) + { + TCHAR szFile[MAX_PATH]; + PFILE_NOTIFY_INFORMATION pNotify; + WatchStruct* pWatch = (WatchStruct*) lpOverlapped; + size_t offset = 0; + + if (dwErrorCode == ERROR_SUCCESS) + { + do + { + pNotify = (PFILE_NOTIFY_INFORMATION) &pWatch->mBuffer[offset]; + offset += pNotify->NextEntryOffset; + +# if defined(UNICODE) + { + lstrcpynW(szFile, pNotify->FileName, + min(MAX_PATH, pNotify->FileNameLength / sizeof(WCHAR) + 1)); + } +# else + { + int count = WideCharToMultiByte(CP_ACP, 0, pNotify->FileName, + pNotify->FileNameLength / sizeof(WCHAR), + szFile, MAX_PATH - 1, NULL, NULL); + szFile[count] = TEXT('\0'); + } +# endif + + pWatch->mFileWatcher->handleAction(pWatch, szFile, pNotify->Action); + + } while (pNotify->NextEntryOffset != 0); + } + + if (!pWatch->mStopNow) + { + RefreshWatch(pWatch); + } + } + + /// Refreshes the directory monitoring. + bool RefreshWatch(WatchStruct* pWatch) + { + return ReadDirectoryChangesW( + pWatch->mDirHandle, pWatch->mBuffer, sizeof(pWatch->mBuffer), FALSE, + pWatch->mNotifyFilter, NULL, &pWatch->mOverlapped, WatchCallback) != 0; + } + + /// Stops monitoring a directory. + void DestroyWatch(WatchStruct* pWatch) + { + if (pWatch) + { + pWatch->mStopNow = TRUE; + + CancelIo(pWatch->mDirHandle); + + if (!HasOverlappedIoCompleted(&pWatch->mOverlapped)) + { + SleepEx(5, TRUE); + } + + CloseHandle(pWatch->mOverlapped.hEvent); + CloseHandle(pWatch->mDirHandle); + delete pWatch->mDirName; + HeapFree(GetProcessHeap(), 0, pWatch); + } + } + + /// Starts monitoring a directory. + WatchStruct* CreateWatch(LPCTSTR szDirectory, DWORD mNotifyFilter) + { + WatchStruct* pWatch; + size_t ptrsize = sizeof(*pWatch); + pWatch = static_cast(HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, ptrsize)); + + pWatch->mDirHandle = CreateFile(szDirectory, FILE_LIST_DIRECTORY, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, + NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OVERLAPPED, NULL); + + if (pWatch->mDirHandle != INVALID_HANDLE_VALUE) + { + pWatch->mOverlapped.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + pWatch->mNotifyFilter = mNotifyFilter; + + if (RefreshWatch(pWatch)) + { + return pWatch; + } + else + { + CloseHandle(pWatch->mOverlapped.hEvent); + CloseHandle(pWatch->mDirHandle); + } + } + + HeapFree(GetProcessHeap(), 0, pWatch); + return NULL; + } + +#pragma endregion + + //-------- + FileWatcherWin32::FileWatcherWin32() + : mLastWatchID(0) + { + } + + //-------- + FileWatcherWin32::~FileWatcherWin32() + { + WatchMap::iterator iter = mWatches.begin(); + WatchMap::iterator end = mWatches.end(); + for(; iter != end; ++iter) + { + DestroyWatch(iter->second); + } + mWatches.clear(); + } + + //-------- + WatchID FileWatcherWin32::addWatch(const String& directory, FileWatchListener* watcher) + { + WatchID watchid = ++mLastWatchID; + + WatchStruct* watch = CreateWatch(directory.c_str(), + FILE_NOTIFY_CHANGE_CREATION | FILE_NOTIFY_CHANGE_SIZE | FILE_NOTIFY_CHANGE_FILE_NAME); + + watch->mWatchid = watchid; + watch->mFileWatcher = this; + watch->mFileWatchListener = watcher; + watch->mDirName = new char[directory.length()+1]; + strcpy(watch->mDirName, directory.c_str()); + + mWatches.insert(std::make_pair(watchid, watch)); + + return watchid; + } + + //-------- + void FileWatcherWin32::removeWatch(const String& directory) + { + WatchMap::iterator iter = mWatches.begin(); + WatchMap::iterator end = mWatches.end(); + for(; iter != end; ++iter) + { + if(directory == iter->second->mDirName) + { + removeWatch(iter->first); + return; + } + } + } + + //-------- + void FileWatcherWin32::removeWatch(WatchID watchid) + { + WatchMap::iterator iter = mWatches.find(watchid); + + if(iter == mWatches.end()) + return; + + WatchStruct* watch = iter->second; + mWatches.erase(iter); + + DestroyWatch(watch); + } + + //-------- + void FileWatcherWin32::update() + { + MsgWaitForMultipleObjectsEx(0, NULL, 0, QS_ALLINPUT, MWMO_ALERTABLE); + } + + //-------- + void FileWatcherWin32::handleAction(WatchStruct* watch, const String& filename, unsigned long action) + { + FileWatcher::Action fwAction; + + switch(action) + { + case FILE_ACTION_RENAMED_NEW_NAME: + case FILE_ACTION_ADDED: + fwAction = FileWatcher::ACTION_ADD; + break; + case FILE_ACTION_RENAMED_OLD_NAME: + case FILE_ACTION_REMOVED: + fwAction = FileWatcher::ACTION_DELETE; + break; + case FILE_ACTION_MODIFIED: + fwAction = FileWatcher::ACTION_MODIFIED; + break; + }; + + watch->mFileWatchListener->handleFileAction(watch->mWatchid, watch->mDirName, filename, fwAction); + } + +};//namespace FW + +#endif//_WIN32 diff --git a/third-party/filewatcher/FileWatcherWin32.h b/third-party/filewatcher/FileWatcherWin32.h new file mode 100644 index 000000000..ef8d0c9fa --- /dev/null +++ b/third-party/filewatcher/FileWatcherWin32.h @@ -0,0 +1,73 @@ +/** + Released under a free dont-bother-me license. I don't claim this + software won't destroy everything that you hold dear, but I really + doubt it will. And please try not to take credit for others' work. + + @author James Wynn + @date 4/15/2009 +*/ + +/** + Implementation for Windows. Uses ReadDirectoryChangesW to watch for + file system changes. +*/ + +#ifndef _FW_FILEWATCHERWIN32_H_ +#define _FW_FILEWATCHERWIN32_H_ +#pragma once + +#ifdef _WIN32 + +#include "FileWatcher.h" +#include + +namespace FW +{ + // forward decl + struct WatchStruct; + + /// + /// @class FileWatcherWin32 + class FileWatcherWin32 + { + public: + /// type for a map from WatchID to WatchStruct pointer + typedef std::map WatchMap; + + public: + /// + /// + FileWatcherWin32(); + + /// + /// + virtual ~FileWatcherWin32(); + + /// Add a directory watch + WatchID addWatch(const String& directory, FileWatchListener* watcher); + + /// Remove a directory watch. This is a brute force lazy search O(nlogn). + void removeWatch(const String& directory); + + /// Remove a directory watch. This is a map lookup O(logn). + void removeWatch(WatchID watchid); + + /// Updates the watcher. Must be called often. + void update(); + + /// Handles the action + void handleAction(WatchStruct* watch, const String& filename, unsigned long action); + + private: + /// Map of WatchID to WatchStruct pointers + WatchMap mWatches; + /// The last watchid + WatchID mLastWatchID; + + };//end FileWatcherWin32 + +};//namespace FW + +#endif//_WIN32 + +#endif//_FW_FILEWATCHERWIN32_H_ diff --git a/third-party/filewatcher/License.txt b/third-party/filewatcher/License.txt new file mode 100644 index 000000000..6215be818 --- /dev/null +++ b/third-party/filewatcher/License.txt @@ -0,0 +1,20 @@ +-- FileWatcher License -- + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it +freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source + distribution. diff --git a/third-party/filewatcher/Makefile b/third-party/filewatcher/Makefile new file mode 100644 index 000000000..f609b66b4 --- /dev/null +++ b/third-party/filewatcher/Makefile @@ -0,0 +1,551 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# third-party/filewatcher/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + + +srcdir = . +top_srcdir = ../.. + +pkgdatadir = $(datadir)/transmission +pkglibdir = $(libdir)/transmission +pkgincludedir = $(includedir)/transmission +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = x86_64-unknown-linux-gnu +host_triplet = x86_64-unknown-linux-gnu +subdir = third-party/filewatcher +DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/acx-pthread.m4 \ + $(top_srcdir)/m4/check-ssl.m4 $(top_srcdir)/m4/glib-gettext.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/wxwin.m4 \ + $(top_srcdir)/m4/zlib.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libfilewatcher_a_AR = $(AR) $(ARFLAGS) +libfilewatcher_a_LIBADD = +am_libfilewatcher_a_OBJECTS = file-watcher.$(OBJEXT) \ + FileWatcher.$(OBJEXT) FileWatcherLinux.$(OBJEXT) \ + FileWatcherOSX.$(OBJEXT) FileWatcherWin32.$(OBJEXT) +libfilewatcher_a_OBJECTS = $(am_libfilewatcher_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libfilewatcher_a_SOURCES) +DIST_SOURCES = $(libfilewatcher_a_SOURCES) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /mnt/home/charles/src/T/missing --run aclocal-1.9 +ALL_LINGUAS = +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /mnt/home/charles/src/T/missing --run tar +AR = ar +AUTOCONF = ${SHELL} /mnt/home/charles/src/T/missing --run autoconf +AUTOHEADER = ${SHELL} /mnt/home/charles/src/T/missing --run autoheader +AUTOMAKE = ${SHELL} /mnt/home/charles/src/T/missing --run automake-1.9 +AWK = gawk +BUILD_CLI_FALSE = # +BUILD_CLI_TRUE = +BUILD_DAEMON_FALSE = # +BUILD_DAEMON_TRUE = +BUILD_GTK_FALSE = # +BUILD_GTK_TRUE = +BUILD_MAC_FALSE = +BUILD_MAC_TRUE = # +BUILD_WX_FALSE = +BUILD_WX_TRUE = # +CATALOGS = +CATOBJEXT = .gmo +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -Os -Wall -W -ggdb3 -g -O0 -std=gnu99 -ggdb3 -Wall -W -Wpointer-arith -Wformat-security -Wcast-align -Wundef -Wcast-align -Wstrict-prototypes -Wmissing-declarations -Wmissing-format-attribute -Wredundant-decls -Wnested-externs -Wunused-parameter -Wwrite-strings -Wextra -Wdeclaration-after-statement -Winit-self +CPP = gcc -E +CPPFLAGS = -I/mnt/home/charles/wx/include -I/mnt/home/charles/wx/include +CURL_MINIMUM = 7.16.3 +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -Os -Wall -W -ggdb3 -g -O0 +CYGPATH_W = echo +DATADIRNAME = share +DBUS_BINDING_TOOL = /usr/bin/dbus-binding-tool +DBUS_GLIB_CFLAGS = -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include +DBUS_GLIB_LIBS = -L/usr/lib64 -L/lib64 -ldbus-glib-1 -ldbus-1 -lgobject-2.0 -lglib-2.0 +DBUS_GLIB_MINIMUM = 0.70 +DEFS = -DPACKAGE_NAME=\"transmission\" -DPACKAGE_TARNAME=\"transmission\" -DPACKAGE_VERSION=\"1.51+\" -DPACKAGE_STRING=\"transmission\ 1.51+\" -DPACKAGE_BUGREPORT=\"http://trac.transmissionbt.com/newticket\" -DPACKAGE=\"transmission\" -DVERSION=\"1.51+\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DTR_NIGHTLY_RELEASE=1 -DSTDC_HEADERS=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_DAEMON=1 -DHAVE_DIRNAME=1 -DHAVE_BASENAME=1 -DHAVE_DAEMON=1 -DHAVE_STRCASECMP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_PTHREAD=1 -DHAVE__TMP_DUMMY1_ZLIB_H=1 -DHAVE_ZLIB=1 -DHAVE_DECL_POSIX_FADVISE=1 -DHAVE_POSIX_FADVISE=1 -DHAVE_DBUS_GLIB=1 -DHAVE_LIBINTL_H=1 -DGETTEXT_PACKAGE=\"transmission\" -DHAVE_LOCALE_H=1 -DHAVE_LC_MESSAGES=1 -DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DENABLE_NLS=1 +DEPDIR = .deps +ECHO = echo +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = grep -E +EXEEXT = +F77 = g77 +FFLAGS = -g -O2 +GETTEXT_PACKAGE = transmission +GIO_CFLAGS = +GIO_LIBS = +GIO_MINIMUM = 2.15.5 +GLIB_MINIMUM = 2.6.0 +GMOFILES = +GMSGFMT = /usr/bin/msgfmt +GTK_CFLAGS = -pthread -I/usr/include/gtk-2.0 -I/usr/lib64/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 +GTK_LIBS = -Wl,--export-dynamic -pthread -L/usr/lib64 -L/lib64 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lm -lpangocairo-1.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -ldl -lgthread-2.0 -lglib-2.0 +GTK_MINIMUM = 2.6.0 +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +INSTOBJEXT = .mo +INTLLIBS = +INTLTOOL_CAVES_RULE = %.caves: %.caves.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_DESKTOP_RULE = %.desktop: %.desktop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_DIRECTORY_RULE = %.directory: %.directory.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_EXTRACT = $(top_builddir)/intltool-extract +INTLTOOL_ICONV = /usr/bin/iconv +INTLTOOL_KBD_RULE = %.kbd: %.kbd.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -m -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_KEYS_RULE = %.keys: %.keys.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -k -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_MERGE = $(top_builddir)/intltool-merge +INTLTOOL_MSGFMT = /usr/bin/msgfmt +INTLTOOL_MSGMERGE = /usr/bin/msgmerge +INTLTOOL_OAF_RULE = %.oaf: %.oaf.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -p $(top_srcdir)/po $< $@ +INTLTOOL_PERL = /usr/bin/perl +INTLTOOL_PONG_RULE = %.pong: %.pong.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_PROP_RULE = %.prop: %.prop.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_SCHEMAS_RULE = %.schemas: %.schemas.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -s -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_SERVER_RULE = %.server: %.server.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -o -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_SERVICE_RULE = %.service: %.service.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_SHEET_RULE = %.sheet: %.sheet.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_SOUNDLIST_RULE = %.soundlist: %.soundlist.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_THEME_RULE = %.theme: %.theme.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -d -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_UI_RULE = %.ui: %.ui.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_UPDATE = $(top_builddir)/intltool-update +INTLTOOL_XAM_RULE = %.xam: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +INTLTOOL_XGETTEXT = /usr/bin/xgettext +INTLTOOL_XML_NOMERGE_RULE = %.xml: %.xml.in $(INTLTOOL_MERGE) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< $@ +INTLTOOL_XML_RULE = %.xml: %.xml.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*.po) ; LC_ALL=C $(INTLTOOL_MERGE) -x -u -c $(top_builddir)/po/.intltool-merge-cache $(top_srcdir)/po $< $@ +LDFLAGS = -L/mnt/home/charles/wx/lib -L/mnt/home/charles/wx/lib +LIBCURL_CFLAGS = -I/mnt/home/charles/opt/curl/include +LIBCURL_LIBS = /mnt/home/charles/opt/curl/lib/libcurl.so +LIBEVENT_CPPFLAGS = -I$(top_srcdir)/third-party/libevent +LIBNOTIFY_CFLAGS = +LIBNOTIFY_LIBS = +LIBNOTIFY_MINIMUM = 0.4.3 +LIBOBJS = +LIBS = +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LN_S = ln -s +LTLIBOBJS = +MAKEINFO = ${SHELL} /mnt/home/charles/src/T/missing --run makeinfo +MKINSTALLDIRS = ./mkinstalldirs +MSGFMT = /usr/bin/msgfmt +OBJEXT = o +OPENSSL_CFLAGS = -I/usr/kerberos/include +OPENSSL_LIBS = -L/usr/lib64 -L/usr/kerberos/lib64 -lssl -lcrypto -ldl -lz +OPENSSL_MINIMUM = 0.9.4 +PACKAGE = transmission +PACKAGE_BUGREPORT = http://trac.transmissionbt.com/newticket +PACKAGE_NAME = transmission +PACKAGE_STRING = transmission 1.51+ +PACKAGE_TARNAME = transmission +PACKAGE_VERSION = 1.51+ +PATH_SEPARATOR = : +PEERID_PREFIX = -TR151Z- +PKG_CONFIG = /mnt/home/charles/bin/pkg-config +POFILES = +POSUB = po +PO_IN_DATADIR_FALSE = +PO_IN_DATADIR_TRUE = +PTHREAD_CC = gcc +PTHREAD_CFLAGS = -pthread +PTHREAD_LIBS = +RANLIB = ranlib +SED = /bin/sed +SET_MAKE = +SHELL = /bin/sh +STRIP = strip +TR_UNSTABLE_FALSE = # +TR_UNSTABLE_TRUE = +USERAGENT_PREFIX = 1.51+ +USE_NLS = yes +VERSION = 1.51+ +WIN32_FALSE = +WIN32_TRUE = # +WINDRES = +WX_CFLAGS = +WX_CFLAGS_ONLY = +WX_CONFIG_PATH = +WX_CPPFLAGS = +WX_CXXFLAGS = +WX_CXXFLAGS_ONLY = +WX_LIBS = +WX_LIBS_STATIC = +WX_MINIMUM = 2.6.0 +WX_RESCOMP = +WX_VERSION = +XGETTEXT = /usr/bin/xgettext +ZLIB_CFLAGS = +ZLIB_LDFLAGS = +ZLIB_LIBS = -lz +ac_ct_AR = ar +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_F77 = g77 +ac_ct_RANLIB = ranlib +ac_ct_STRIP = strip +ac_ct_WINDRES = +ac_pt_PKG_CONFIG = /mnt/home/charles/bin/pkg-config +acx_pthread_config = +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__fastdepCXX_FALSE = # +am__fastdepCXX_TRUE = +am__include = include +am__leading_dot = . +am__quote = +am__tar = tar --format=ustar -chf - "$$tardir" +am__untar = tar -xf - +bindir = ${exec_prefix}/bin +build = x86_64-unknown-linux-gnu +build_alias = +build_cpu = x86_64 +build_os = linux-gnu +build_vendor = unknown +datadir = ${prefix}/share +exec_prefix = ${prefix} +host = x86_64-unknown-linux-gnu +host_alias = +host_cpu = x86_64 +host_os = linux-gnu +host_vendor = unknown +includedir = ${prefix}/include +infodir = ${prefix}/info +install_sh = /mnt/home/charles/src/T/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localstatedir = ${prefix}/var +mandir = ${prefix}/man +mkdir_p = mkdir -p -- +oldincludedir = /usr/include +prefix = /usr/local +program_transform_name = s,x,x, +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +subdirs = third-party/libevent +sysconfdir = ${prefix}/etc +target_alias = +transmissionlocaledir = ${prefix}/${DATADIRNAME}/locale +noinst_LIBRARIES = libfilewatcher.a +AM_CPPFLAGS = -DNDEBUG +libfilewatcher_a_SOURCES = \ + file-watcher.cpp \ + FileWatcher.cpp \ + FileWatcherLinux.cpp \ + FileWatcherOSX.cpp \ + FileWatcherWin32.cpp + +noinst_HEADERS = \ + file-watcher.h \ + FileWatcher.h \ + FileWatcherLinux.h \ + FileWatcherOSX.h \ + FileWatcherWin32.h + +extra_DIST = \ + README \ + ReadMe.txt \ + License.txt + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu third-party/filewatcher/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu third-party/filewatcher/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libfilewatcher.a: $(libfilewatcher_a_OBJECTS) $(libfilewatcher_a_DEPENDENCIES) + -rm -f libfilewatcher.a + $(libfilewatcher_a_AR) libfilewatcher.a $(libfilewatcher_a_OBJECTS) $(libfilewatcher_a_LIBADD) + $(RANLIB) libfilewatcher.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +include ./$(DEPDIR)/FileWatcher.Po +include ./$(DEPDIR)/FileWatcherLinux.Po +include ./$(DEPDIR)/FileWatcherOSX.Po +include ./$(DEPDIR)/FileWatcherWin32.Po +include ./$(DEPDIR)/file-watcher.Po + +.cpp.o: + if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: + if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=no \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: + if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ + then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +# source='$<' object='$@' libtool=yes \ +# DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) \ +# $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/third-party/filewatcher/Makefile.am b/third-party/filewatcher/Makefile.am new file mode 100644 index 000000000..eade6e7e5 --- /dev/null +++ b/third-party/filewatcher/Makefile.am @@ -0,0 +1,22 @@ +noinst_LIBRARIES = libfilewatcher.a + +AM_CPPFLAGS = -DNDEBUG + +libfilewatcher_a_SOURCES = \ + file-watcher.cpp \ + FileWatcher.cpp \ + FileWatcherLinux.cpp \ + FileWatcherOSX.cpp \ + FileWatcherWin32.cpp + +noinst_HEADERS = \ + file-watcher.h \ + FileWatcher.h \ + FileWatcherLinux.h \ + FileWatcherOSX.h \ + FileWatcherWin32.h + +extra_DIST = \ + README \ + ReadMe.txt \ + License.txt diff --git a/third-party/filewatcher/Makefile.in b/third-party/filewatcher/Makefile.in new file mode 100644 index 000000000..29fa97aa1 --- /dev/null +++ b/third-party/filewatcher/Makefile.in @@ -0,0 +1,551 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = third-party/filewatcher +DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/acx-pthread.m4 \ + $(top_srcdir)/m4/check-ssl.m4 $(top_srcdir)/m4/glib-gettext.m4 \ + $(top_srcdir)/m4/pkg.m4 $(top_srcdir)/m4/wxwin.m4 \ + $(top_srcdir)/m4/zlib.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +libfilewatcher_a_AR = $(AR) $(ARFLAGS) +libfilewatcher_a_LIBADD = +am_libfilewatcher_a_OBJECTS = file-watcher.$(OBJEXT) \ + FileWatcher.$(OBJEXT) FileWatcherLinux.$(OBJEXT) \ + FileWatcherOSX.$(OBJEXT) FileWatcherWin32.$(OBJEXT) +libfilewatcher_a_OBJECTS = $(am_libfilewatcher_a_OBJECTS) +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(libfilewatcher_a_SOURCES) +DIST_SOURCES = $(libfilewatcher_a_SOURCES) +HEADERS = $(noinst_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +BUILD_CLI_FALSE = @BUILD_CLI_FALSE@ +BUILD_CLI_TRUE = @BUILD_CLI_TRUE@ +BUILD_DAEMON_FALSE = @BUILD_DAEMON_FALSE@ +BUILD_DAEMON_TRUE = @BUILD_DAEMON_TRUE@ +BUILD_GTK_FALSE = @BUILD_GTK_FALSE@ +BUILD_GTK_TRUE = @BUILD_GTK_TRUE@ +BUILD_MAC_FALSE = @BUILD_MAC_FALSE@ +BUILD_MAC_TRUE = @BUILD_MAC_TRUE@ +BUILD_WX_FALSE = @BUILD_WX_FALSE@ +BUILD_WX_TRUE = @BUILD_WX_TRUE@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CURL_MINIMUM = @CURL_MINIMUM@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DBUS_BINDING_TOOL = @DBUS_BINDING_TOOL@ +DBUS_GLIB_CFLAGS = @DBUS_GLIB_CFLAGS@ +DBUS_GLIB_LIBS = @DBUS_GLIB_LIBS@ +DBUS_GLIB_MINIMUM = @DBUS_GLIB_MINIMUM@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIO_CFLAGS = @GIO_CFLAGS@ +GIO_LIBS = @GIO_LIBS@ +GIO_MINIMUM = @GIO_MINIMUM@ +GLIB_MINIMUM = @GLIB_MINIMUM@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GTK_CFLAGS = @GTK_CFLAGS@ +GTK_LIBS = @GTK_LIBS@ +GTK_MINIMUM = @GTK_MINIMUM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_CAVES_RULE = @INTLTOOL_CAVES_RULE@ +INTLTOOL_DESKTOP_RULE = @INTLTOOL_DESKTOP_RULE@ +INTLTOOL_DIRECTORY_RULE = @INTLTOOL_DIRECTORY_RULE@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_ICONV = @INTLTOOL_ICONV@ +INTLTOOL_KBD_RULE = @INTLTOOL_KBD_RULE@ +INTLTOOL_KEYS_RULE = @INTLTOOL_KEYS_RULE@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_MSGFMT = @INTLTOOL_MSGFMT@ +INTLTOOL_MSGMERGE = @INTLTOOL_MSGMERGE@ +INTLTOOL_OAF_RULE = @INTLTOOL_OAF_RULE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_PONG_RULE = @INTLTOOL_PONG_RULE@ +INTLTOOL_PROP_RULE = @INTLTOOL_PROP_RULE@ +INTLTOOL_SCHEMAS_RULE = @INTLTOOL_SCHEMAS_RULE@ +INTLTOOL_SERVER_RULE = @INTLTOOL_SERVER_RULE@ +INTLTOOL_SERVICE_RULE = @INTLTOOL_SERVICE_RULE@ +INTLTOOL_SHEET_RULE = @INTLTOOL_SHEET_RULE@ +INTLTOOL_SOUNDLIST_RULE = @INTLTOOL_SOUNDLIST_RULE@ +INTLTOOL_THEME_RULE = @INTLTOOL_THEME_RULE@ +INTLTOOL_UI_RULE = @INTLTOOL_UI_RULE@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_XAM_RULE = @INTLTOOL_XAM_RULE@ +INTLTOOL_XGETTEXT = @INTLTOOL_XGETTEXT@ +INTLTOOL_XML_NOMERGE_RULE = @INTLTOOL_XML_NOMERGE_RULE@ +INTLTOOL_XML_RULE = @INTLTOOL_XML_RULE@ +LDFLAGS = @LDFLAGS@ +LIBCURL_CFLAGS = @LIBCURL_CFLAGS@ +LIBCURL_LIBS = @LIBCURL_LIBS@ +LIBEVENT_CPPFLAGS = @LIBEVENT_CPPFLAGS@ +LIBNOTIFY_CFLAGS = @LIBNOTIFY_CFLAGS@ +LIBNOTIFY_LIBS = @LIBNOTIFY_LIBS@ +LIBNOTIFY_MINIMUM = @LIBNOTIFY_MINIMUM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJEXT = @OBJEXT@ +OPENSSL_CFLAGS = @OPENSSL_CFLAGS@ +OPENSSL_LIBS = @OPENSSL_LIBS@ +OPENSSL_MINIMUM = @OPENSSL_MINIMUM@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PEERID_PREFIX = @PEERID_PREFIX@ +PKG_CONFIG = @PKG_CONFIG@ +POFILES = @POFILES@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PTHREAD_CC = @PTHREAD_CC@ +PTHREAD_CFLAGS = @PTHREAD_CFLAGS@ +PTHREAD_LIBS = @PTHREAD_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TR_UNSTABLE_FALSE = @TR_UNSTABLE_FALSE@ +TR_UNSTABLE_TRUE = @TR_UNSTABLE_TRUE@ +USERAGENT_PREFIX = @USERAGENT_PREFIX@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WIN32_FALSE = @WIN32_FALSE@ +WIN32_TRUE = @WIN32_TRUE@ +WINDRES = @WINDRES@ +WX_CFLAGS = @WX_CFLAGS@ +WX_CFLAGS_ONLY = @WX_CFLAGS_ONLY@ +WX_CONFIG_PATH = @WX_CONFIG_PATH@ +WX_CPPFLAGS = @WX_CPPFLAGS@ +WX_CXXFLAGS = @WX_CXXFLAGS@ +WX_CXXFLAGS_ONLY = @WX_CXXFLAGS_ONLY@ +WX_LIBS = @WX_LIBS@ +WX_LIBS_STATIC = @WX_LIBS_STATIC@ +WX_MINIMUM = @WX_MINIMUM@ +WX_RESCOMP = @WX_RESCOMP@ +WX_VERSION = @WX_VERSION@ +XGETTEXT = @XGETTEXT@ +ZLIB_CFLAGS = @ZLIB_CFLAGS@ +ZLIB_LDFLAGS = @ZLIB_LDFLAGS@ +ZLIB_LIBS = @ZLIB_LIBS@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +ac_ct_RANLIB = @ac_ct_RANLIB@ +ac_ct_STRIP = @ac_ct_STRIP@ +ac_ct_WINDRES = @ac_ct_WINDRES@ +ac_pt_PKG_CONFIG = @ac_pt_PKG_CONFIG@ +acx_pthread_config = @acx_pthread_config@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +subdirs = @subdirs@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +transmissionlocaledir = @transmissionlocaledir@ +noinst_LIBRARIES = libfilewatcher.a +AM_CPPFLAGS = -DNDEBUG +libfilewatcher_a_SOURCES = \ + file-watcher.cpp \ + FileWatcher.cpp \ + FileWatcherLinux.cpp \ + FileWatcherOSX.cpp \ + FileWatcherWin32.cpp + +noinst_HEADERS = \ + file-watcher.h \ + FileWatcher.h \ + FileWatcherLinux.h \ + FileWatcherOSX.h \ + FileWatcherWin32.h + +extra_DIST = \ + README \ + ReadMe.txt \ + License.txt + +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu third-party/filewatcher/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu third-party/filewatcher/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +libfilewatcher.a: $(libfilewatcher_a_OBJECTS) $(libfilewatcher_a_DEPENDENCIES) + -rm -f libfilewatcher.a + $(libfilewatcher_a_AR) libfilewatcher.a $(libfilewatcher_a_OBJECTS) $(libfilewatcher_a_LIBADD) + $(RANLIB) libfilewatcher.a + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileWatcher.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileWatcherLinux.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileWatcherOSX.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/FileWatcherWin32.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file-watcher.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(LIBRARIES) $(HEADERS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/third-party/filewatcher/README b/third-party/filewatcher/README new file mode 100644 index 000000000..ffbd08078 --- /dev/null +++ b/third-party/filewatcher/README @@ -0,0 +1,5 @@ +License.txt, ReadMe.txt, and C++ source files +are from the 2009.02.17 Snapshot of FileWatcher by Jason Wynn at http://jameswynn.com/tag/filewatcher/ + +file-watcher.cc, file-watcher.h +is a very simple wrapper for C around Jason's library diff --git a/third-party/filewatcher/ReadMe.txt b/third-party/filewatcher/ReadMe.txt new file mode 100644 index 000000000..0ccac7638 --- /dev/null +++ b/third-party/filewatcher/ReadMe.txt @@ -0,0 +1,27 @@ +-- FileWatcher -- + +Description: + +FileWatcher is a C++ wrapper for OS file monitoring systems. Currently +it uses Win32 ReadDirectoryChangesW for monitoring changes in Windows, +and inotify in linux. There are plans for extending to OSX and BSD. + + +Windows: + +Builds in Visual Studio 2005 (no UNICODE support yet, sorry) +After building the demo app you will need to copy over the Ogre3d and OIS +dlls (at least OgreMain_d.dll, RenderSystem_Direct3D9_d.dll, and OIS_d.dll). + +During the demo run the various batch files in the media directory to change +the current texture. These changes are automatically caught by FileWatcher +and will update the texture in the demo. + + +Linux/OSX: + +Should just be able to use the Makefile to build the demo. + + +Written by James Wynn +Contact: james@jameswynn.com diff --git a/third-party/filewatcher/file-watcher.cpp b/third-party/filewatcher/file-watcher.cpp new file mode 100644 index 000000000..93651c620 --- /dev/null +++ b/third-party/filewatcher/file-watcher.cpp @@ -0,0 +1,61 @@ +/** + * A C wrapper around James Wynn's FileWatcher library. + * + * Released under a free dont-bother-me license. I don't claim this + * software won't destroy everything that you hold dear, but I really + * doubt it will. And please try not to take credit for others' work. + */ + +#include +#include "file-watcher.h" +#include "FileWatcher.h" + +using namespace FW; + +struct CFW_Impl: public FileWatchListener +{ + private: + FileWatcher myWatcher; + WatchID myID; + CFW_ActionCallback * myCallback; + void * myCallbackData; + + public: + CFW_Impl( const char * dir, CFW_ActionCallback * callback, void * callbackData ): + myID( myWatcher.addWatch( dir, this ) ), + myCallback( callback ), + myCallbackData( callbackData ) + { + } + virtual ~CFW_Impl( ) + { + myWatcher.removeWatch( myID ); + } + virtual void handleFileAction( WatchID watchid, const String& dir, const String& filename, FileWatcher::Action action ) + { +std::cerr << __FILE__ << ':' << __LINE__ << " dir is " << dir << " filename is " << filename << std::endl; + (*myCallback)( this, dir.c_str(), filename.c_str(), (CFW_Action)action, myCallbackData ); + } + void update( ) + { + myWatcher.update( ); + } +}; + +extern "C" CFW_Watch* +cfw_addWatch( const char * directory, CFW_ActionCallback * callback, void * callbackData ) +{ + return new CFW_Impl( directory, callback, callbackData ); +} + +extern "C" void +cfw_removeWatch( CFW_Watch * watch ) +{ + delete watch; +} + +extern "C" void +cfw_update( CFW_Watch * watch ) +{ + watch->update( ); +} diff --git a/third-party/filewatcher/file-watcher.h b/third-party/filewatcher/file-watcher.h new file mode 100644 index 000000000..6e25a1c72 --- /dev/null +++ b/third-party/filewatcher/file-watcher.h @@ -0,0 +1,44 @@ +/** + * A C wrapper around James Wynn's FileWatcher library. + * + * Released under a free dont-bother-me license. I don't claim this + * software won't destroy everything that you hold dear, but I really + * doubt it will. And please try not to take credit for others' work. + */ + +#ifndef _CFW_FILEWATCHER_H_ +#define _CFW_FILEWATCHER_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Actions to listen for. Rename will send two events, one for + * the deletion of the old file, and one for the creation of the + * new file. + */ +typedef enum +{ + CFW_ACTION_ADD = (1<<0), /* Sent when a file is created or renamed */ + CFW_ACTION_DELETE = (1<<1), /* Sent when a file is deleted or renamed */ + CFW_ACTION_MODIFIED = (1<<2) /* Sent when a file is modified */ +} +CFW_Action; + +typedef struct CFW_Impl CFW_Watch; + +typedef void ( CFW_ActionCallback )( CFW_Watch*, const char * dir, const char * filename, CFW_Action, void * callbackData ); + +CFW_Watch* cfw_addWatch ( const char * directory, CFW_ActionCallback * callback, void * callbackData ); + +void cfw_removeWatch ( CFW_Watch * ); + +void cfw_update ( CFW_Watch * ); + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/third-party/filewatcher/makelog b/third-party/filewatcher/makelog new file mode 100644 index 000000000..8182b59a1 --- /dev/null +++ b/third-party/filewatcher/makelog @@ -0,0 +1,16 @@ +if g++ -DPACKAGE_NAME=\"transmission\" -DPACKAGE_TARNAME=\"transmission\" -DPACKAGE_VERSION=\"1.51+\" -DPACKAGE_STRING=\"transmission\ 1.51+\" -DPACKAGE_BUGREPORT=\"http://trac.transmissionbt.com/newticket\" -DPACKAGE=\"transmission\" -DVERSION=\"1.51+\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DTR_NIGHTLY_RELEASE=1 -DSTDC_HEADERS=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_DAEMON=1 -DHAVE_DIRNAME=1 -DHAVE_BASENAME=1 -DHAVE_DAEMON=1 -DHAVE_STRCASECMP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_PTHREAD=1 -DHAVE__TMP_DUMMY1_ZLIB_H=1 -DHAVE_ZLIB=1 -DHAVE_DECL_POSIX_FADVISE=1 -DHAVE_POSIX_FADVISE=1 -DHAVE_DBUS_GLIB=1 -DHAVE_LIBINTL_H=1 -DGETTEXT_PACKAGE=\"transmission\" -DHAVE_LOCALE_H=1 -DHAVE_LC_MESSAGES=1 -DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DENABLE_NLS=1 -I. -I. -DNDEBUG -I/mnt/home/charles/wx/include -I/mnt/home/charles/wx/include -Os -Wall -W -ggdb3 -g -O0 -MT file-watcher.o -MD -MP -MF ".deps/file-watcher.Tpo" -c -o file-watcher.o file-watcher.cpp; \ + then mv -f ".deps/file-watcher.Tpo" ".deps/file-watcher.Po"; else rm -f ".deps/file-watcher.Tpo"; exit 1; fi +if g++ -DPACKAGE_NAME=\"transmission\" -DPACKAGE_TARNAME=\"transmission\" -DPACKAGE_VERSION=\"1.51+\" -DPACKAGE_STRING=\"transmission\ 1.51+\" -DPACKAGE_BUGREPORT=\"http://trac.transmissionbt.com/newticket\" -DPACKAGE=\"transmission\" -DVERSION=\"1.51+\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DTR_NIGHTLY_RELEASE=1 -DSTDC_HEADERS=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_DAEMON=1 -DHAVE_DIRNAME=1 -DHAVE_BASENAME=1 -DHAVE_DAEMON=1 -DHAVE_STRCASECMP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_PTHREAD=1 -DHAVE__TMP_DUMMY1_ZLIB_H=1 -DHAVE_ZLIB=1 -DHAVE_DECL_POSIX_FADVISE=1 -DHAVE_POSIX_FADVISE=1 -DHAVE_DBUS_GLIB=1 -DHAVE_LIBINTL_H=1 -DGETTEXT_PACKAGE=\"transmission\" -DHAVE_LOCALE_H=1 -DHAVE_LC_MESSAGES=1 -DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DENABLE_NLS=1 -I. -I. -DNDEBUG -I/mnt/home/charles/wx/include -I/mnt/home/charles/wx/include -Os -Wall -W -ggdb3 -g -O0 -MT FileWatcher.o -MD -MP -MF ".deps/FileWatcher.Tpo" -c -o FileWatcher.o FileWatcher.cpp; \ + then mv -f ".deps/FileWatcher.Tpo" ".deps/FileWatcher.Po"; else rm -f ".deps/FileWatcher.Tpo"; exit 1; fi +if g++ -DPACKAGE_NAME=\"transmission\" -DPACKAGE_TARNAME=\"transmission\" -DPACKAGE_VERSION=\"1.51+\" -DPACKAGE_STRING=\"transmission\ 1.51+\" -DPACKAGE_BUGREPORT=\"http://trac.transmissionbt.com/newticket\" -DPACKAGE=\"transmission\" -DVERSION=\"1.51+\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DTR_NIGHTLY_RELEASE=1 -DSTDC_HEADERS=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_DAEMON=1 -DHAVE_DIRNAME=1 -DHAVE_BASENAME=1 -DHAVE_DAEMON=1 -DHAVE_STRCASECMP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_PTHREAD=1 -DHAVE__TMP_DUMMY1_ZLIB_H=1 -DHAVE_ZLIB=1 -DHAVE_DECL_POSIX_FADVISE=1 -DHAVE_POSIX_FADVISE=1 -DHAVE_DBUS_GLIB=1 -DHAVE_LIBINTL_H=1 -DGETTEXT_PACKAGE=\"transmission\" -DHAVE_LOCALE_H=1 -DHAVE_LC_MESSAGES=1 -DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DENABLE_NLS=1 -I. -I. -DNDEBUG -I/mnt/home/charles/wx/include -I/mnt/home/charles/wx/include -Os -Wall -W -ggdb3 -g -O0 -MT FileWatcherLinux.o -MD -MP -MF ".deps/FileWatcherLinux.Tpo" -c -o FileWatcherLinux.o FileWatcherLinux.cpp; \ + then mv -f ".deps/FileWatcherLinux.Tpo" ".deps/FileWatcherLinux.Po"; else rm -f ".deps/FileWatcherLinux.Tpo"; exit 1; fi +if g++ -DPACKAGE_NAME=\"transmission\" -DPACKAGE_TARNAME=\"transmission\" -DPACKAGE_VERSION=\"1.51+\" -DPACKAGE_STRING=\"transmission\ 1.51+\" -DPACKAGE_BUGREPORT=\"http://trac.transmissionbt.com/newticket\" -DPACKAGE=\"transmission\" -DVERSION=\"1.51+\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DTR_NIGHTLY_RELEASE=1 -DSTDC_HEADERS=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_DAEMON=1 -DHAVE_DIRNAME=1 -DHAVE_BASENAME=1 -DHAVE_DAEMON=1 -DHAVE_STRCASECMP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_PTHREAD=1 -DHAVE__TMP_DUMMY1_ZLIB_H=1 -DHAVE_ZLIB=1 -DHAVE_DECL_POSIX_FADVISE=1 -DHAVE_POSIX_FADVISE=1 -DHAVE_DBUS_GLIB=1 -DHAVE_LIBINTL_H=1 -DGETTEXT_PACKAGE=\"transmission\" -DHAVE_LOCALE_H=1 -DHAVE_LC_MESSAGES=1 -DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DENABLE_NLS=1 -I. -I. -DNDEBUG -I/mnt/home/charles/wx/include -I/mnt/home/charles/wx/include -Os -Wall -W -ggdb3 -g -O0 -MT FileWatcherOSX.o -MD -MP -MF ".deps/FileWatcherOSX.Tpo" -c -o FileWatcherOSX.o FileWatcherOSX.cpp; \ + then mv -f ".deps/FileWatcherOSX.Tpo" ".deps/FileWatcherOSX.Po"; else rm -f ".deps/FileWatcherOSX.Tpo"; exit 1; fi +if g++ -DPACKAGE_NAME=\"transmission\" -DPACKAGE_TARNAME=\"transmission\" -DPACKAGE_VERSION=\"1.51+\" -DPACKAGE_STRING=\"transmission\ 1.51+\" -DPACKAGE_BUGREPORT=\"http://trac.transmissionbt.com/newticket\" -DPACKAGE=\"transmission\" -DVERSION=\"1.51+\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DTR_NIGHTLY_RELEASE=1 -DSTDC_HEADERS=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_DAEMON=1 -DHAVE_DIRNAME=1 -DHAVE_BASENAME=1 -DHAVE_DAEMON=1 -DHAVE_STRCASECMP=1 -DHAVE_LOCALTIME_R=1 -DHAVE_POSIX_FALLOCATE=1 -DHAVE_PTHREAD=1 -DHAVE__TMP_DUMMY1_ZLIB_H=1 -DHAVE_ZLIB=1 -DHAVE_DECL_POSIX_FADVISE=1 -DHAVE_POSIX_FADVISE=1 -DHAVE_DBUS_GLIB=1 -DHAVE_LIBINTL_H=1 -DGETTEXT_PACKAGE=\"transmission\" -DHAVE_LOCALE_H=1 -DHAVE_LC_MESSAGES=1 -DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DENABLE_NLS=1 -I. -I. -DNDEBUG -I/mnt/home/charles/wx/include -I/mnt/home/charles/wx/include -Os -Wall -W -ggdb3 -g -O0 -MT FileWatcherWin32.o -MD -MP -MF ".deps/FileWatcherWin32.Tpo" -c -o FileWatcherWin32.o FileWatcherWin32.cpp; \ + then mv -f ".deps/FileWatcherWin32.Tpo" ".deps/FileWatcherWin32.Po"; else rm -f ".deps/FileWatcherWin32.Tpo"; exit 1; fi +file-watcher.cpp:33: warning: unused parameter ‘watchid’ +FileWatcherLinux.cpp: In member function ‘void FW::FileWatcherLinux::update()’: +FileWatcherLinux.cpp:124: warning: unused variable ‘action’ +rm -f libfilewatcher.a +ar cru libfilewatcher.a file-watcher.o FileWatcher.o FileWatcherLinux.o FileWatcherOSX.o FileWatcherWin32.o +ranlib libfilewatcher.a -- 2.40.0