From 0a2d48f6d86c48c1f643a28f6f4f9420a3cf58ad Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Tue, 14 Oct 2014 15:51:31 +0200 Subject: temporary for winhttp fetcher (and tests/fetcher) on Windows, needs also c c:\temp directory for now --- src/libcrawler/SpoolRewindInputStream.cpp | 13 ++++++++++--- tests/fetcher/Makefile.W32 | 3 ++- tests/fetcher/run.cmd | 2 ++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/libcrawler/SpoolRewindInputStream.cpp b/src/libcrawler/SpoolRewindInputStream.cpp index 7108cc9..6d04e4d 100644 --- a/src/libcrawler/SpoolRewindInputStream.cpp +++ b/src/libcrawler/SpoolRewindInputStream.cpp @@ -5,6 +5,13 @@ #include #include +// TODO: thread-safe and platform-conformant name of spool file +#ifndef _WIN32 +#define SPOOL_FILE_NAME "/tmp/spool.tmp" +#else +#define SPOOL_FILE_NAME "C:\\TEMP\\SPOOL.TMP" +#endif + using namespace std; spool_streambuf::spool_streambuf( size_t bufSize, size_t putBack, size_t spoolBufSize ) @@ -29,7 +36,7 @@ spool_streambuf::~spool_streambuf( ) case TO_SPOOL_FILE: case FROM_SPOOL_FILE: m_spoolFile.close( ); - (void)remove( "/tmp/spool.tmp" ); + (void)remove( SPOOL_FILE_NAME ); break; } } @@ -70,7 +77,7 @@ void spool_streambuf::spoolData( char *data, size_t n ) // ..otherwise start spooling to disk, write // current memory spool buffer first.. LOG( logWARNING ) << "Spooling spool buffer exceeded (>" << m_spoolBufSize << ")"; - m_spoolFile.open( "/tmp/spool.tmp", ios::binary | ios::out | ios::trunc ); + m_spoolFile.open( SPOOL_FILE_NAME, ios::binary | ios::out | ios::trunc ); assert( m_spoolFile.good( ) ); m_spoolFile.write( &m_spoolBuf.front( ), m_spoolBufSize ); assert( m_spoolFile.good( ) ); @@ -176,7 +183,7 @@ void spool_streambuf::rewind( ) case TO_SPOOL_FILE: m_spoolFile.close( ); - m_spoolFile.open( "/tmp/spool.tmp", ios::binary | ios::in ); + m_spoolFile.open( SPOOL_FILE_NAME, ios::binary | ios::in ); m_spoolFile.seekg( 0, ios::end ); m_spoolBufSize = m_spoolFile.tellg( ); m_spoolFile.seekg( 0, ios::beg ); diff --git a/tests/fetcher/Makefile.W32 b/tests/fetcher/Makefile.W32 index b4e5128..0ebfb09 100755 --- a/tests/fetcher/Makefile.W32 +++ b/tests/fetcher/Makefile.W32 @@ -11,6 +11,7 @@ INCLUDE_CXXFLAGS = \ INCLUDE_DIRS = \ /I. \ /I$(TOPDIR)\src \ + /I$(TOPDIR)\include \ /I$(TOPDIR)\include\module \ /I$(TOPDIR)\include\util \ /I$(TOPDIR)\include\crawler \ @@ -22,7 +23,7 @@ INCLUDE_LDFLAGS = \ INCLUDE_LIBS = \ $(TOPDIR)\src\modules\fetcher\winhttp\winhttpfetcher.lib \ WinHttp.lib \ - $(TOPDIR)\src\modules\urlnormalizer\simpleurl\simpleurlnormalizerstatic.lib \ + $(TOPDIR)\src\modules\urlnormalizer\simpleurl\simpleurlnormalizer.lib \ $(TOPDIR)\src\libcrawler\crawlerstatic.lib \ $(TOPDIR)\src\libutil\util.lib diff --git a/tests/fetcher/run.cmd b/tests/fetcher/run.cmd index 5b6b4b5..041633f 100644 --- a/tests/fetcher/run.cmd +++ b/tests/fetcher/run.cmd @@ -3,5 +3,7 @@ copy ..\..\src\libcrawler\crawler.dll . >NUL copy ..\..\src\liblogger\logger.dll . >NUL copy ..\..\src\libutil\util.dll . >NUL +copy ..\..\src\libluaglue\luaglue.dll . >NUL +copy ..\..\lua\src\lua52.dll . >NUL test1 %1 %2 -- cgit v1.2.3-54-g00ecf