up:远端不存在目录校验功能测试完毕。
This commit is contained in:
@@ -89,12 +89,12 @@ void ClientCore::handleAsk(QSharedPointer<FrameBuffer> frame)
|
||||
if (msg.command == STRMSG_AC_CHECK_FILE_EXIST) {
|
||||
msg.command = STRMSG_AC_ANSWER_FILE_EXIST;
|
||||
for (auto& item : msg.mapData) {
|
||||
if (item.mark == STRMSG_AC_UP) {
|
||||
if (!Util::DirExist(item.key, true)) {
|
||||
if (item.command == STRMSG_AC_UP) {
|
||||
if (!Util::DirExist(item.path, false)) {
|
||||
item.state = static_cast<qint32>(FCS_DIR_NOT_EXIST);
|
||||
}
|
||||
} else {
|
||||
if (!Util::FileExist(item.key)) {
|
||||
if (!Util::FileExist(item.path)) {
|
||||
item.state = static_cast<qint32>(FCS_FILE_NOT_EXIST);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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