Add RsFiles::requestFiles to de API to download whole colletions

Fix filetree creation from single file
RsDirUtil::moveFile now works also if parent directories doesn't exists
Backport std::filesystem::create_directories from C++17
This commit is contained in:
Gioacchino Mazzurco 2020-03-22 10:49:55 +01:00
parent d666e58403
commit 55aab6c447
No known key found for this signature in database
GPG key ID: A1FBCA3872E87051
8 changed files with 227 additions and 54 deletions

View file

@ -489,10 +489,10 @@ public:
/**
* @brief Initiate downloading of a file
* @jsonapi{development}
* @param[in] fileName
* @param[in] hash
* @param[in] size
* @param[in] destPath in not empty specify a destination path
* @param[in] fileName file name
* @param[in] hash file hash
* @param[in] size file size
* @param[in] destPath optional specify the destination directory
* @param[in] flags you usually want RS_FILE_REQ_ANONYMOUS_ROUTING
* @param[in] srcIds eventually specify known sources
* @return false if we already have the file, true otherwhise
@ -502,6 +502,25 @@ public:
const std::string& destPath, TransferRequestFlags flags,
const std::list<RsPeerId>& srcIds ) = 0;
/**
* @brief Initiate download of a files collection
* @jsonapi{development}
* An usually useful companion method of this is @see parseFilesLink()
* @param[in] collection collection of files to download
* @param[in] destPath optional base path on which to download the
* collection, if left empty the default download directory will be used
* @param[in] srcIds optional peers id known as direct source of the
* collection
* @param[in] flags optional flags to fine tune search and download
* algorithm
* @return success or error details.
*/
virtual std::error_condition requestFiles(
const RsFileTree& collection,
const std::string& destPath = "",
const std::vector<RsPeerId>& srcIds = std::vector<RsPeerId>(),
FileRequestFlags flags = FileRequestFlags::ANONYMOUS_ROUTING ) = 0;
/**
* @brief Cancel file downloading
* @jsonapi{development}
@ -924,8 +943,6 @@ public:
virtual std::error_condition parseFilesLink(
const std::string& link, RsFileTree& collection ) = 0;
// virtual std::error_condition downloadFilesLink(FileRequestFlags)
/**
* @brief Get list of ignored file name prefixes and suffixes
* @param[out] ignoredPrefixes storage for ingored prefixes

View file

@ -366,6 +366,8 @@ struct DirDetails : RsSerializable
RS_SERIAL_PROCESS(children);
RS_SERIAL_PROCESS(parent_groups);
}
~DirDetails() override = default;
};
class FileDetail