2009-07-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>

Added function returning suffix of control file to
	DefaultBtProgressInfoFile.
	* src/DefaultBtProgressInfoFile.cc
	* src/DefaultBtProgressInfoFile.h
	* src/RequestGroup.cc
pull/1/head
Tatsuhiro Tsujikawa 2009-07-11 10:19:10 +00:00
parent c0c12cdd81
commit d99ec1534f
4 changed files with 20 additions and 6 deletions

View File

@ -1,3 +1,11 @@
2009-07-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Added function returning suffix of control file to
DefaultBtProgressInfoFile.
* src/DefaultBtProgressInfoFile.cc
* src/DefaultBtProgressInfoFile.h
* src/RequestGroup.cc
2009-07-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net> 2009-07-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Documented getVersion in man page. Documented getVersion in man page.

View File

@ -66,10 +66,11 @@ namespace aria2 {
const std::string DefaultBtProgressInfoFile::V0000("0000"); const std::string DefaultBtProgressInfoFile::V0000("0000");
const std::string DefaultBtProgressInfoFile::V0001("0001"); const std::string DefaultBtProgressInfoFile::V0001("0001");
static std::string createFilename(const SharedHandle<DownloadContext>& dctx) static std::string createFilename
(const SharedHandle<DownloadContext>& dctx, const std::string& suffix)
{ {
std::string t = dctx->getBasePath(); std::string t = dctx->getBasePath();
t += ".aria2"; t += suffix;
return t; return t;
} }
@ -81,14 +82,14 @@ DefaultBtProgressInfoFile::DefaultBtProgressInfoFile
_pieceStorage(pieceStorage), _pieceStorage(pieceStorage),
_option(option), _option(option),
_logger(LogFactory::getInstance()), _logger(LogFactory::getInstance()),
_filename(createFilename(_dctx)) _filename(createFilename(_dctx, getSuffix()))
{} {}
DefaultBtProgressInfoFile::~DefaultBtProgressInfoFile() {} DefaultBtProgressInfoFile::~DefaultBtProgressInfoFile() {}
void DefaultBtProgressInfoFile::updateFilename() void DefaultBtProgressInfoFile::updateFilename()
{ {
_filename = createFilename(_dctx); _filename = createFilename(_dctx, getSuffix());
} }
bool DefaultBtProgressInfoFile::isTorrentDownload() bool DefaultBtProgressInfoFile::isTorrentDownload()

View File

@ -88,6 +88,12 @@ public:
void setBtRuntime(const SharedHandle<BtRuntime>& btRuntime); void setBtRuntime(const SharedHandle<BtRuntime>& btRuntime);
#endif // ENABLE_BITTORRENT #endif // ENABLE_BITTORRENT
static const std::string& getSuffix()
{
static std::string suffix = ".aria2";
return suffix;
}
}; };
} // namespace aria2 } // namespace aria2

View File

@ -557,8 +557,7 @@ bool RequestGroup::tryAutoFileRenaming()
} }
for(unsigned int i = 1; i < 10000; ++i) { for(unsigned int i = 1; i < 10000; ++i) {
File newfile(strconcat(filepath, ".", Util::uitos(i))); File newfile(strconcat(filepath, ".", Util::uitos(i)));
// TODO1.5 hard coded ".aria2" extension. File ctrlfile(newfile.getPath()+DefaultBtProgressInfoFile::getSuffix());
File ctrlfile(newfile.getPath()+".aria2");
if(!newfile.exists() || (newfile.exists() && ctrlfile.exists())) { if(!newfile.exists() || (newfile.exists() && ctrlfile.exists())) {
_downloadContext->getFirstFileEntry()->setPath(newfile.getPath()); _downloadContext->getFirstFileEntry()->setPath(newfile.getPath());
return true; return true;