Symlink ~/cuttlefish_runtime to ~/cuttlefish_runtime.<first>

Automated tools used to the single-instance cuttlefish expect the bare
~/cuttlefish_runtime directory to contain the necessary log files, and
this is still convenient when running with a single instance otherwise.

This change allows users to still access the files they expect at
~/cuttlefish_runtime, while they will have to give the instance number
for other instances.

Bug: 140071236
Test: launch_cvd, ls -l ~/
Change-Id: I908b1ee1a7f7062920cc44dbaec6a191f123b644
diff --git a/host/commands/assemble_cvd/flags.cc b/host/commands/assemble_cvd/flags.cc
index 5e9cb57..241912b 100644
--- a/host/commands/assemble_cvd/flags.cc
+++ b/host/commands/assemble_cvd/flags.cc
@@ -568,6 +568,7 @@
   for (const auto& instance : config.Instances()) {
     paths.push_back(instance.instance_dir());
   }
+  paths.push_back(FLAGS_instance_dir);
   return CleanPriorFiles(paths, preserving);
 }
 
@@ -778,6 +779,12 @@
     }
   }
 
+  std::string first_instance = FLAGS_instance_dir + "." + std::to_string(vsoc::GetInstance());
+  if (symlink(first_instance.c_str(), FLAGS_instance_dir.c_str()) < 0) {
+    LOG(ERROR) << "Could not symlink \"" << first_instance << "\" to \"" << FLAGS_instance_dir << "\"";
+    exit(cvd::kCuttlefishConfigurationInitError);
+  }
+
   if (!cvd::FileHasContent(FLAGS_boot_image)) {
     LOG(ERROR) << "File not found: " << FLAGS_boot_image;
     exit(cvd::kCuttlefishConfigurationInitError);