Rename CacheLocation to Paths.
We have a general need for overriding more paths (e.g. "/tmp"), mostly
for testing purpose. Rename CacheLocation to Paths, and use that to
manage TEMPORARY_{INSTALL,LOG}_FILE.
Test: mmma -j bootable/recovery
Test: recovery_component_test
Change-Id: Ia8ce8e5695df37ca434f13ac4d3206de1e8e9396
diff --git a/applypatch/freecache.cpp b/applypatch/freecache.cpp
index cfab0f6..dbd4b72 100644
--- a/applypatch/freecache.cpp
+++ b/applypatch/freecache.cpp
@@ -38,7 +38,7 @@
#include <android-base/strings.h>
#include "applypatch/applypatch.h"
-#include "otautil/cache_location.h"
+#include "otautil/paths.h"
static int EliminateOpenFiles(const std::string& dirname, std::set<std::string>* files) {
std::unique_ptr<DIR, decltype(&closedir)> d(opendir("/proc"), closedir);
@@ -95,7 +95,7 @@
// We can't delete cache_temp_source; if it's there we might have restarted during
// installation and could be depending on it to be there.
- if (path == CacheLocation::location().cache_temp_source()) {
+ if (path == Paths::Get().cache_temp_source()) {
continue;
}
@@ -142,7 +142,7 @@
return 0;
#endif
- std::vector<std::string> dirs = { "/cache", CacheLocation::location().cache_log_directory() };
+ std::vector<std::string> dirs = { "/cache", Paths::Get().cache_log_directory() };
for (const auto& dirname : dirs) {
if (RemoveFilesInDirectory(bytes_needed, dirname, FreeSpaceForFile)) {
return 0;
@@ -172,7 +172,7 @@
}
std::vector<std::string> files;
- if (dirname == CacheLocation::location().cache_log_directory()) {
+ if (dirname == Paths::Get().cache_log_directory()) {
// Deletes the log files only.
auto log_filter = [](const std::string& file_name) {
return android::base::StartsWith(file_name, "last_log") ||