fix creating empty directory (empty path)

This commit is contained in:
Green Sky 2023-10-14 01:01:40 +02:00
parent f904b321bc
commit 0404ed84fc
No known key found for this signature in database

View File

@ -241,7 +241,9 @@ bool ToxTransferManager::setFilePath(Message3Handle transfer, std::string_view f
uint64_t file_size {0}; uint64_t file_size {0};
std::filesystem::path full_file_path{file_path}; std::filesystem::path full_file_path{file_path};
std::filesystem::create_directories(full_file_path.parent_path()); if (auto parent_path = full_file_path.parent_path(); !parent_path.empty()) {
std::filesystem::create_directories(parent_path);
}
// TODO: read file name(s) from comp // TODO: read file name(s) from comp
if (transfer.all_of<Message::Components::Transfer::FileInfo>()) { if (transfer.all_of<Message::Components::Transfer::FileInfo>()) {