|
@@ -246,9 +246,10 @@ SharedHandle<CheckIntegrityEntry> RequestGroup::createCheckIntegrityEntry()
|
|
#endif // ENABLE_MESSAGE_DIGEST
|
|
#endif // ENABLE_MESSAGE_DIGEST
|
|
{
|
|
{
|
|
downloadContext_->setChecksumVerified(true);
|
|
downloadContext_->setChecksumVerified(true);
|
|
- A2_LOG_NOTICE(fmt(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
|
|
|
- util::itos(gid_).c_str(),
|
|
|
|
- downloadContext_->getBasePath().c_str()));
|
|
|
|
|
|
+ A2_LOG_NOTICE
|
|
|
|
+ (fmt(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
|
|
|
+ util::itos(gid_).c_str(),
|
|
|
|
+ utf8ToNative(downloadContext_->getBasePath()).c_str()));
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
checkEntry.reset(new StreamCheckIntegrityEntry(this));
|
|
checkEntry.reset(new StreamCheckIntegrityEntry(this));
|
|
@@ -267,9 +268,10 @@ SharedHandle<CheckIntegrityEntry> RequestGroup::createCheckIntegrityEntry()
|
|
#endif // ENABLE_MESSAGE_DIGEST
|
|
#endif // ENABLE_MESSAGE_DIGEST
|
|
{
|
|
{
|
|
downloadContext_->setChecksumVerified(true);
|
|
downloadContext_->setChecksumVerified(true);
|
|
- A2_LOG_NOTICE(fmt(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
|
|
|
- util::itos(gid_).c_str(),
|
|
|
|
- downloadContext_->getBasePath().c_str()));
|
|
|
|
|
|
+ A2_LOG_NOTICE
|
|
|
|
+ (fmt(MSG_DOWNLOAD_ALREADY_COMPLETED,
|
|
|
|
+ util::itos(gid_).c_str(),
|
|
|
|
+ utf8ToNative(downloadContext_->getBasePath()).c_str()));
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
loadAndOpenFile(infoFile);
|
|
loadAndOpenFile(infoFile);
|
|
@@ -312,7 +314,7 @@ void RequestGroup::createInitialCommand
|
|
if(e->getRequestGroupMan()->isSameFileBeingDownloaded(this)) {
|
|
if(e->getRequestGroupMan()->isSameFileBeingDownloaded(this)) {
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
|
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
|
- downloadContext_->getBasePath().c_str()),
|
|
|
|
|
|
+ utf8ToNative(downloadContext_->getBasePath()).c_str()),
|
|
error_code::DUPLICATE_DOWNLOAD);
|
|
error_code::DUPLICATE_DOWNLOAD);
|
|
}
|
|
}
|
|
initPieceStorage();
|
|
initPieceStorage();
|
|
@@ -419,7 +421,7 @@ void RequestGroup::createInitialCommand
|
|
// TODO we need this->haltRequested = true?
|
|
// TODO we need this->haltRequested = true?
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
(fmt(MSG_FILE_ALREADY_EXISTS,
|
|
(fmt(MSG_FILE_ALREADY_EXISTS,
|
|
- downloadContext_->getBasePath().c_str()),
|
|
|
|
|
|
+ utf8ToNative(downloadContext_->getBasePath()).c_str()),
|
|
error_code::FILE_ALREADY_EXISTS);
|
|
error_code::FILE_ALREADY_EXISTS);
|
|
} else {
|
|
} else {
|
|
pieceStorage_->getDiskAdaptor()->openFile();
|
|
pieceStorage_->getDiskAdaptor()->openFile();
|
|
@@ -484,7 +486,7 @@ void RequestGroup::createInitialCommand
|
|
if(e->getRequestGroupMan()->isSameFileBeingDownloaded(this)) {
|
|
if(e->getRequestGroupMan()->isSameFileBeingDownloaded(this)) {
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
|
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
|
- downloadContext_->getBasePath().c_str()),
|
|
|
|
|
|
+ utf8ToNative(downloadContext_->getBasePath()).c_str()),
|
|
error_code::DUPLICATE_DOWNLOAD);
|
|
error_code::DUPLICATE_DOWNLOAD);
|
|
}
|
|
}
|
|
SharedHandle<BtProgressInfoFile> progressInfoFile
|
|
SharedHandle<BtProgressInfoFile> progressInfoFile
|
|
@@ -511,7 +513,7 @@ void RequestGroup::createInitialCommand
|
|
if(e->getRequestGroupMan()->isSameFileBeingDownloaded(this)) {
|
|
if(e->getRequestGroupMan()->isSameFileBeingDownloaded(this)) {
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
|
(fmt(EX_DUPLICATE_FILE_DOWNLOAD,
|
|
- downloadContext_->getBasePath().c_str()),
|
|
|
|
|
|
+ utf8ToNative(downloadContext_->getBasePath()).c_str()),
|
|
error_code::DUPLICATE_DOWNLOAD);
|
|
error_code::DUPLICATE_DOWNLOAD);
|
|
}
|
|
}
|
|
initPieceStorage();
|
|
initPieceStorage();
|
|
@@ -535,7 +537,7 @@ void RequestGroup::createInitialCommand
|
|
// TODO we need this->haltRequested = true?
|
|
// TODO we need this->haltRequested = true?
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
(fmt(MSG_FILE_ALREADY_EXISTS,
|
|
(fmt(MSG_FILE_ALREADY_EXISTS,
|
|
- downloadContext_->getBasePath().c_str()),
|
|
|
|
|
|
+ utf8ToNative(downloadContext_->getBasePath()).c_str()),
|
|
error_code::FILE_ALREADY_EXISTS);
|
|
error_code::FILE_ALREADY_EXISTS);
|
|
} else {
|
|
} else {
|
|
pieceStorage_->getDiskAdaptor()->openFile();
|
|
pieceStorage_->getDiskAdaptor()->openFile();
|
|
@@ -720,7 +722,7 @@ void RequestGroup::removeDefunctControlFile
|
|
progressInfoFile->removeFile();
|
|
progressInfoFile->removeFile();
|
|
A2_LOG_NOTICE(fmt(MSG_REMOVED_DEFUNCT_CONTROL_FILE,
|
|
A2_LOG_NOTICE(fmt(MSG_REMOVED_DEFUNCT_CONTROL_FILE,
|
|
progressInfoFile->getFilename().c_str(),
|
|
progressInfoFile->getFilename().c_str(),
|
|
- downloadContext_->getBasePath().c_str()));
|
|
|
|
|
|
+ utf8ToNative(downloadContext_->getBasePath()).c_str()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -769,17 +771,18 @@ void RequestGroup::shouldCancelDownloadForSafety()
|
|
if(outfile.exists()) {
|
|
if(outfile.exists()) {
|
|
if(option_->getAsBool(PREF_AUTO_FILE_RENAMING)) {
|
|
if(option_->getAsBool(PREF_AUTO_FILE_RENAMING)) {
|
|
if(tryAutoFileRenaming()) {
|
|
if(tryAutoFileRenaming()) {
|
|
- A2_LOG_NOTICE(fmt(MSG_FILE_RENAMED, getFirstFilePath().c_str()));
|
|
|
|
|
|
+ A2_LOG_NOTICE(fmt(MSG_FILE_RENAMED,
|
|
|
|
+ utf8ToNative(getFirstFilePath()).c_str()));
|
|
} else {
|
|
} else {
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
(fmt("File renaming failed: %s",
|
|
(fmt("File renaming failed: %s",
|
|
- getFirstFilePath().c_str()),
|
|
|
|
|
|
+ utf8ToNative(getFirstFilePath()).c_str()),
|
|
error_code::FILE_RENAMING_FAILED);
|
|
error_code::FILE_RENAMING_FAILED);
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
throw DOWNLOAD_FAILURE_EXCEPTION2
|
|
(fmt(MSG_FILE_ALREADY_EXISTS,
|
|
(fmt(MSG_FILE_ALREADY_EXISTS,
|
|
- getFirstFilePath().c_str()),
|
|
|
|
|
|
+ utf8ToNative(getFirstFilePath()).c_str()),
|
|
error_code::FILE_ALREADY_EXISTS);
|
|
error_code::FILE_ALREADY_EXISTS);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -1036,7 +1039,7 @@ void RequestGroup::releaseRuntimeResource(DownloadEngine* e)
|
|
void RequestGroup::preDownloadProcessing()
|
|
void RequestGroup::preDownloadProcessing()
|
|
{
|
|
{
|
|
A2_LOG_DEBUG(fmt("Finding PreDownloadHandler for path %s.",
|
|
A2_LOG_DEBUG(fmt("Finding PreDownloadHandler for path %s.",
|
|
- getFirstFilePath().c_str()));
|
|
|
|
|
|
+ utf8ToNative(getFirstFilePath()).c_str()));
|
|
try {
|
|
try {
|
|
for(std::vector<SharedHandle<PreDownloadHandler> >::const_iterator itr =
|
|
for(std::vector<SharedHandle<PreDownloadHandler> >::const_iterator itr =
|
|
preDownloadHandlers_.begin(), eoi = preDownloadHandlers_.end();
|
|
preDownloadHandlers_.begin(), eoi = preDownloadHandlers_.end();
|
|
@@ -1058,7 +1061,7 @@ void RequestGroup::postDownloadProcessing
|
|
(std::vector<SharedHandle<RequestGroup> >& groups)
|
|
(std::vector<SharedHandle<RequestGroup> >& groups)
|
|
{
|
|
{
|
|
A2_LOG_DEBUG(fmt("Finding PostDownloadHandler for path %s.",
|
|
A2_LOG_DEBUG(fmt("Finding PostDownloadHandler for path %s.",
|
|
- getFirstFilePath().c_str()));
|
|
|
|
|
|
+ utf8ToNative(getFirstFilePath()).c_str()));
|
|
try {
|
|
try {
|
|
for(std::vector<SharedHandle<PostDownloadHandler> >::const_iterator itr =
|
|
for(std::vector<SharedHandle<PostDownloadHandler> >::const_iterator itr =
|
|
postDownloadHandlers_.begin(), eoi = postDownloadHandlers_.end();
|
|
postDownloadHandlers_.begin(), eoi = postDownloadHandlers_.end();
|
|
@@ -1200,7 +1203,7 @@ DownloadResultHandle RequestGroup::createDownloadResult() const
|
|
void RequestGroup::reportDownloadFinished()
|
|
void RequestGroup::reportDownloadFinished()
|
|
{
|
|
{
|
|
A2_LOG_NOTICE(fmt(MSG_FILE_DOWNLOAD_COMPLETED,
|
|
A2_LOG_NOTICE(fmt(MSG_FILE_DOWNLOAD_COMPLETED,
|
|
- downloadContext_->getBasePath().c_str()));
|
|
|
|
|
|
+ utf8ToNative(downloadContext_->getBasePath()).c_str()));
|
|
uriSelector_->resetCounters();
|
|
uriSelector_->resetCounters();
|
|
#ifdef ENABLE_BITTORRENT
|
|
#ifdef ENABLE_BITTORRENT
|
|
if(downloadContext_->hasAttribute(bittorrent::BITTORRENT)) {
|
|
if(downloadContext_->hasAttribute(bittorrent::BITTORRENT)) {
|