diff --git a/src/data_transfer.cpp b/src/data_transfer.cpp index 3d379f34baf5d9dfe461f8220d3c2635af992da3..e540c5eec376f297bd9f356d71f6f0f1402eeec6 100644 --- a/src/data_transfer.cpp +++ b/src/data_transfer.cpp @@ -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> diff --git a/src/data_transfer.h b/src/data_transfer.h index 8ba13fee05c4038914ac307f8a71cce88a6b7541..133e3289d8f892db4a6717b86860916c4c0ccd7e 100644 --- a/src/data_transfer.h +++ b/src/data_transfer.h @@ -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() diff --git a/src/jamidht/transfer_channel_handler.cpp b/src/jamidht/transfer_channel_handler.cpp index 172fd47cfd1ddf5889312b3408ec3e926a0f926e..add85574269d96b74de3c31a89b0bb7c41e341e3 100644 --- a/src/jamidht/transfer_channel_handler.cpp +++ b/src/jamidht/transfer_channel_handler.cpp @@ -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