diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-02-07 09:13:08 -0800 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-02-07 09:13:08 -0800 |
| commit | d24b192f8c724662e1a8f93fd8e72d79dba04a86 (patch) | |
| tree | 280842817b6d3095ba56ef49414343e998671d03 /node/SoftwareUpdater.cpp | |
| parent | 0442d7e2d66e54bfe2462aabf2362f3fecdd7b4c (diff) | |
| download | infinitytier-d24b192f8c724662e1a8f93fd8e72d79dba04a86.tar.gz infinitytier-d24b192f8c724662e1a8f93fd8e72d79dba04a86.zip | |
Remove old updates from updates.d on Node startup.
Diffstat (limited to 'node/SoftwareUpdater.cpp')
| -rw-r--r-- | node/SoftwareUpdater.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/node/SoftwareUpdater.cpp b/node/SoftwareUpdater.cpp index 0ce946ad..4d11afa9 100644 --- a/node/SoftwareUpdater.cpp +++ b/node/SoftwareUpdater.cpp @@ -41,6 +41,7 @@ #include "RuntimeEnvironment.hpp" #include "Thread.hpp" #include "Node.hpp" +#include "Utils.hpp" #ifdef __UNIX_LIKE__ #include <unistd.h> @@ -74,6 +75,16 @@ SoftwareUpdater::~SoftwareUpdater() } } +void SoftwareUpdater::cleanOldUpdates() +{ + std::string updatesDir(_r->homePath + ZT_PATH_SEPARATOR_S + "updates.d"); + std::map<std::string,bool> dl(Utils::listDirectory(updatesDir.c_str())); + for(std::map<std::string,bool>::iterator i(dl.begin());i!=dl.end();++i) { + if (!i->second) + Utils::rm(i->first.c_str()); + } +} + const char *SoftwareUpdater::parseNfo( const char *nfoText, unsigned int &vMajor, |
