Skip to content
Snippets Groups Projects
Commit 9832e803 authored by Adrien Béraud's avatar Adrien Béraud
Browse files

data transfer: return filesystem::path

Change-Id: I9fa3dc2be03856fbd0e647ce6f15d11ccb6881ee
parent f074cf9d
Branches
Tags
No related merge requests found
......@@ -369,7 +369,7 @@ TransferManager::info(const std::string& fileId,
auto itI = pimpl_->incomings_.find(fileId);
auto itW = pimpl_->waitingIds_.find(fileId);
path = this->path(fileId);
path = this->path(fileId).string();
if (itI != pimpl_->incomings_.end()) {
total = itI->second->info().totalSize;
progress = itI->second->info().bytesProgress;
......@@ -478,10 +478,10 @@ TransferManager::onIncomingFileTransfer(const std::string& fileId,
}
}
std::string
std::filesystem::path
TransferManager::path(const std::string& fileId) const
{
return (pimpl_->conversationDataPath_ / fileId).string();
return pimpl_->conversationDataPath_ / fileId;
}
void
......@@ -560,11 +560,10 @@ TransferManager::onIncomingProfile(const std::shared_ptr<dhtnet::ChannelSocket>&
}
}
std::string
std::filesystem::path
TransferManager::profilePath(const std::string& contactId) const
{
// TODO iOS?
return (pimpl_->profilesPath_ / fmt::format("{}.vcf", base64::encode(contactId))).string();
return pimpl_->profilesPath_ / fmt::format("{}.vcf", base64::encode(contactId));
}
std::vector<WaitingRequest>
......
......@@ -188,7 +188,7 @@ public:
* Retrieve path of a file
* @param id
*/
std::string path(const std::string& fileId) const;
std::filesystem::path path(const std::string& fileId) const;
/**
* Retrieve waiting files
......@@ -202,7 +202,7 @@ public:
* @param contactId contact's id
* @return where profile.vcf is stored
*/
std::string profilePath(const std::string& contactId) const;
std::filesystem::path profilePath(const std::string& contactId) const;
private:
std::weak_ptr<TransferManager> weak()
......
......@@ -164,7 +164,7 @@ TransferChannelHandler::onReady(const std::shared_ptr<dht::crypto::Certificate>&
return;
} else if (isContactProfile && fileId.find(".vcf") != std::string::npos) {
auto path = acc->dataTransfer()->profilePath(fileId.substr(0, fileId.size() - 4));
acc->dataTransfer()->transferFile(channel, fileId, "", path);
acc->dataTransfer()->transferFile(channel, fileId, "", path.string());
return;
} else if (fileId == "profile.vcf") {
acc->dataTransfer()->onIncomingProfile(channel, sha3Sum);
......@@ -178,8 +178,8 @@ TransferChannelHandler::onReady(const std::shared_ptr<dht::crypto::Certificate>&
return;
}
auto interactionId = fileId.substr(0, sep);
std::string path = dt->path(fileId);
dt->transferFile(channel, fileId, interactionId, path, start, end);
auto path = dt->path(fileId);
dt->transferFile(channel, fileId, interactionId, path.string(), start, end);
}
} // namespace jami
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment