@@ -34,27 +34,28 @@ using std::vector;
3434
3535BinaryLauncherBase::BinaryLauncherBase (
3636 const LaunchDataParser::LaunchInfo& _launch_info, int argc, char * argv[])
37- : launch_info(_launch_info) {
38- this ->workspace_name = GetLaunchInfoByKey (WORKSPACE_NAME);
37+ : launch_info(_launch_info),
38+ manifest_file (FindManifestFile(argv[0 ])),
39+ workspace_name(GetLaunchInfoByKey(WORKSPACE_NAME)) {
3940 for (int i = 0 ; i < argc; i++) {
4041 this ->commandline_arguments .push_back (argv[i]);
4142 }
42- ParseManifestFile (&this ->manifest_file_map , FindManifestFile () );
43+ ParseManifestFile (&this ->manifest_file_map , this -> manifest_file );
4344}
4445
45- string BinaryLauncherBase::FindManifestFile () const {
46+ string BinaryLauncherBase::FindManifestFile (const char * argv0) {
4647 // Get the name of the binary
47- string binary = GetBinaryPathWithoutExtension (this -> commandline_arguments [ 0 ] );
48+ string binary = GetBinaryPathWithoutExtension (argv0 );
4849
4950 // Try to find <path to binary>.runfiles/MANIFEST
5051 string manifest_file = binary + " .runfiles\\ MANIFEST" ;
51- if (DoesFilePathExist (manifest_file)) {
52+ if (DoesFilePathExist (manifest_file. c_str () )) {
5253 return manifest_file;
5354 }
5455
5556 // Also try to check if <path to binary>.runfiles_manifest exists
5657 manifest_file = binary + " .runfiles_manifest" ;
57- if (DoesFilePathExist (manifest_file)) {
58+ if (DoesFilePathExist (manifest_file. c_str () )) {
5859 return manifest_file;
5960 }
6061
@@ -125,6 +126,8 @@ void BinaryLauncherBase::CreateCommandLine(
125126
126127ExitCode BinaryLauncherBase::LaunchProcess (
127128 const string& executable, const vector<string>& arguments) const {
129+ SetEnvironmentVariableA (" RUNFILES_MANIFEST_ONLY" , " 1" );
130+ SetEnvironmentVariableA (" RUNFILES_MANIFEST_FILE" , manifest_file.c_str ());
128131 CmdLine cmdline;
129132 CreateCommandLine (&cmdline, executable, arguments);
130133 PROCESS_INFORMATION processInfo = {0 };
0 commit comments