up:远端不存在目录校验功能测试完毕。
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "FileTrans.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
FileTrans::FileTrans(ClientCore* clientCore) : clientCore_(clientCore)
|
||||
@@ -164,6 +165,19 @@ void FileTrans::fbtReqSend(QSharedPointer<FrameBuffer> frame)
|
||||
}
|
||||
|
||||
// recv
|
||||
if (!Util::DirExist(info.toPath, false)) {
|
||||
QDir dir;
|
||||
if (!dir.mkpath(info.toPath)) {
|
||||
info.msg = QString(tr("创建目录失败:%1")).arg(info.toPath);
|
||||
qCritical() << info.msg;
|
||||
auto f = clientCore_->GetBuffer(info, FBT_CLI_CANOT_SEND, frame->fid);
|
||||
if (!ClientCore::syncInvoke(clientCore_, f)) {
|
||||
qCritical() << QString(tr("%1 回复 %2 失败。")).arg(info.msg, f->fid);
|
||||
}
|
||||
return;
|
||||
}
|
||||
qInfo() << QString(tr("目录 %1 不存在,已自动创建。")).arg(info.toPath);
|
||||
}
|
||||
auto newerPath = Util::Get2FilePath(info.fromPath, info.toPath);
|
||||
downTask_->file.setFileName(newerPath);
|
||||
if (!downTask_->file.open(QIODevice::WriteOnly)) {
|
||||
@@ -171,9 +185,8 @@ void FileTrans::fbtReqSend(QSharedPointer<FrameBuffer> frame)
|
||||
qCritical() << info.msg;
|
||||
auto f = clientCore_->GetBuffer(info, FBT_CLI_CANOT_SEND, frame->fid);
|
||||
if (!ClientCore::syncInvoke(clientCore_, f)) {
|
||||
qCritical() << QString(tr("打开接收文件 %2 失败,回复 %2 失败。")).arg(info.msg, f->fid);
|
||||
qCritical() << QString(tr("打开接收文件 %1 失败,回复 %2 失败。")).arg(info.msg, f->fid);
|
||||
downTask_->file.close();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user