--- ftplibftpt.cpp 2009-09-24 22:06:39.000000000 +1000 +++ /Users/nicc/local/src/PocketSword/src/mgr/ftplibftpt.cpp 2009-09-24 22:10:05.000000000 +1000 @@ -34,6 +34,7 @@ SWORD_NAMESPACE_START static FTPLibFTPTransport_init _FTPLibFTPTransport_init; +static SWBuf tmpFile = "swftplib.tmp"; FTPLibFTPTransport_init::FTPLibFTPTransport_init() { FtpInit(); @@ -54,6 +55,10 @@ FTPLibFTPTransport::~FTPLibFTPTransport( FtpQuit(ftpConnection); } +void FTPLibFTPTransport::setTmpFile(const char *filePath) { + tmpFile = filePath; +} + char FTPLibFTPTransport::assureLoggedIn() { char retVal = 0; @@ -85,7 +90,7 @@ char FTPLibFTPTransport::getURL(const ch if (retVal) return retVal; SWBuf sourcePath = sourceURL; - SWBuf outFile = (!destBuf) ? destPath : "swftplib.tmp"; + SWBuf outFile = (!destBuf) ? destPath : tmpFile.c_str(); sourcePath << (6 + host.length()); // shift << "ftp://hostname"; SWLog::getSystemLog()->logDebug("getting file %s to %s\n", sourcePath.c_str(), outFile.c_str()); if (passive) @@ -108,13 +113,13 @@ char FTPLibFTPTransport::getURL(const ch // If not, we probably want to add x-platform way to open a tmp file with FileMgr // This wreaks and will easily fail if a user's CWD is not writable. if (destBuf) { - FileDesc *fd = FileMgr::getSystemFileMgr()->open("swftplib.tmp", FileMgr::RDONLY); + FileDesc *fd = FileMgr::getSystemFileMgr()->open(tmpFile.c_str(), FileMgr::RDONLY); long size = fd->seek(0, SEEK_END); fd->seek(0, SEEK_SET); destBuf->size(size); fd->read(destBuf->getRawData(), size); FileMgr::getSystemFileMgr()->close(fd); - FileMgr::removeFile("swftplib.tmp"); + FileMgr::removeFile(tmpFile.c_str()); } return retVal;