summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Schuffelen <schuffelen@google.com>2019-11-12 16:34:49 -0800
committerCody Schuffelen <schuffelen@google.com>2019-11-12 16:36:20 -0800
commit802eccd2b5b54e46552ac280a2423a41006c6a38 (patch)
treed29d257c2b92cf8460252df2810262bf65636129
parent3b821daa1ed816ef36e97ec0d839e01459adc5b4 (diff)
downloadcuttlefish_common-802eccd2b5b54e46552ac280a2423a41006c6a38.tar.gz
Disable scanning the filesystem for cuttlefish-related files
This is fragile/unstable and is not yet necessary for running the device locally. While the file list matters more for instances produced by the fetch_cvd downloader, that already produces a file list on a separate code path. Test: Build and run launch_cvd Bug: 144189763 Change-Id: I5b4cd2e48c7cf9308dce53ee0aef75e7b7e1dae5
-rw-r--r--host/commands/launch/filesystem_explorer.cc72
1 files changed, 0 insertions, 72 deletions
diff --git a/host/commands/launch/filesystem_explorer.cc b/host/commands/launch/filesystem_explorer.cc
index 18ed0d8a..2fd41feb 100644
--- a/host/commands/launch/filesystem_explorer.cc
+++ b/host/commands/launch/filesystem_explorer.cc
@@ -28,62 +28,6 @@
#include "common/libs/utils/environment.h"
#include "host/libs/config/fetcher_config.h"
-namespace {
-
-/*
- * Returns the paths of all files in `directory_path`.
- *
- * This is a shallow exploration that ignores directories, i.e. it only prints
- * any regular files.
- */
-std::set<std::string> ReportFiles(const std::string& directory_path,
- const std::string& suffix = "") {
- // TODO(schuffelen): Put this in a common library.
- DIR* directory = opendir(directory_path.c_str());
- if (!directory) {
- int error_num = errno;
- LOG(ERROR) << "ReportFiles could not open " << directory_path << " ("
- << strerror(error_num) << ")";
- return {};
- }
- struct dirent* entry;
- std::set<std::string> found_files;
- while ((entry = readdir(directory)) != NULL) {
- if (entry->d_type == DT_DIR) {
- continue;
- }
- std::string full_path = directory_path + "/" + std::string(entry->d_name);
- if (suffix != "" && full_path.compare(full_path.length() - suffix.length(),
- suffix.length(), suffix) != 0) {
- continue;
- }
- found_files.insert(full_path);
- }
- closedir(directory);
- return found_files;
-}
-
-/**
- * Report files that are present based on some heuristics for relevance.
- *
- * This is used in cases where it's not clear in advance whether there are
- * Cuttlefish files in the given directory.
- */
-std::set<std::string> HeuristicFileReport(const std::string& directory_path) {
- std::set<std::string> files;
- if (cvd::FileExists(directory_path + "/bin/launch_cvd")) {
- files.merge(ReportFiles(directory_path + "/bin"));
- }
- bool has_super_img = cvd::FileExists(directory_path + "/super.img");
- bool has_android_info = cvd::FileExists(directory_path + "/android-info.txt");
- if (has_super_img || has_android_info) {
- files.merge(ReportFiles(directory_path));
- }
- return files;
-}
-
-} // namespace
-
cvd::FetcherConfig AvailableFilesReport() {
std::string current_directory = cvd::AbsolutePath(cvd::CurrentDirectory());
if (cvd::FileExists(current_directory + "/fetcher_config.json")) {
@@ -93,22 +37,6 @@ cvd::FetcherConfig AvailableFilesReport() {
}
std::set<std::string> files;
- std::string host_out = cvd::StringFromEnv("ANDROID_HOST_OUT", "");
- if (host_out != "") {
- files.merge(ReportFiles(cvd::AbsolutePath(host_out + "/bin")));
- }
-
- std::string product_out = cvd::StringFromEnv("ANDROID_PRODUCT_OUT", "");
- if (product_out != "") {
- files.merge(ReportFiles(cvd::AbsolutePath(product_out), ".img"));
- }
-
- files.merge(HeuristicFileReport(current_directory));
-
- std::string home = cvd::StringFromEnv("HOME", "");
- if (home != "" && cvd::AbsolutePath(home) != current_directory) {
- files.merge(HeuristicFileReport(home));
- }
std::string psuedo_fetcher_dir =
cvd::StringFromEnv("ANDROID_HOST_OUT",