mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-13 16:27:38 +01:00
+ HashedStorage::Destroy()
This commit is contained in:
parent
5a09c11e90
commit
d010d3575d
2 changed files with 11 additions and 0 deletions
|
@ -270,6 +270,15 @@ namespace fs {
|
|||
boost::filesystem::remove(path);
|
||||
}
|
||||
|
||||
void HashedStorage::Destroy() {
|
||||
std::string storage_root = GetRoot ();
|
||||
if (storage_root.empty()) {
|
||||
LogPrint(eLogError, "FS: you're trying to call HashedStorage.Destroy() before .SetPlace(), fix your code!");
|
||||
return;
|
||||
}
|
||||
boost::filesystem::remove_all(storage_root);
|
||||
}
|
||||
|
||||
void HashedStorage::Traverse(std::vector<std::string> & files) {
|
||||
Iterate([&files] (const std::string & fname) {
|
||||
files.push_back(fname);
|
||||
|
|
|
@ -65,6 +65,8 @@ namespace fs {
|
|||
void Traverse(std::vector<std::string> & files);
|
||||
/** visit every file in this storage with a visitor */
|
||||
void Iterate(FilenameVisitor v);
|
||||
/** remove ALL contents of storage and it's root dir */
|
||||
void Destroy();
|
||||
};
|
||||
|
||||
/** @brief Returns current application name, default 'i2pd' */
|
||||
|
|
Loading…
Add table
Reference in a new issue