/// <summary> /// Applies an <see cref="ExecutableInPath"/> binding by creating a run-environment executable. /// </summary> /// <param name="binding">The binding to apply.</param> /// <param name="implementation">The implementation to be made available.</param> /// <param name="startInfo">The process launch environment to use to make the run-environment executable available.</param> /// <exception cref="KeyNotFoundException"><see cref="Selections"/> points to missing <see cref="Dependency"/>s.</exception> /// <exception cref="ImplementationNotFoundException">One of the <see cref="Store.Model.Implementation"/>s is not cached yet.</exception> /// <exception cref="ExecutorException"><see cref="ExecutableInPath.Name"/> is invalid.</exception> /// <exception cref="IOException">A problem occurred while writing the file.</exception> /// <exception cref="UnauthorizedAccessException">Write access to the file is not permitted.</exception> private void ApplyExecutableInPath(ExecutableInPath binding, ImplementationSelection implementation, ProcessStartInfo startInfo) { Log.Debug("Applying " + binding + " for " + implementation); if (string.IsNullOrEmpty(binding.Name)) { throw new ExecutorException(string.Format(Resources.MissingBindingName, @"<executable-in-path>")); } if (Path.GetInvalidFileNameChars().Any(invalidChar => binding.Name.Contains(invalidChar.ToString(CultureInfo.InvariantCulture)))) { throw new ExecutorException(string.Format(Resources.IllegalCharInBindingName, @"<executable-in-path>")); } string exePath = DeployRunEnvExecutable(binding.Name); // Add executable directory to PATH variable startInfo.EnvironmentVariables["PATH"] = Path.GetDirectoryName(exePath) + Path.PathSeparator + startInfo.EnvironmentVariables["PATH"]; // Tell the executable what command-line to run _runEnvPendings.Add(new RunEnvPending(binding.Name, GetCommandLine(implementation, binding.Command ?? Command.NameRun, startInfo))); }
/// <summary> /// Applies an <see cref="ExecutableInPath"/> binding by creating a run-environment executable. /// </summary> /// <param name="binding">The binding to apply.</param> /// <param name="implementation">The implementation to be made available.</param> /// <param name="startInfo">The process launch environment to use to make the run-environment executable available.</param> /// <exception cref="KeyNotFoundException"><see cref="Selections"/> points to missing <see cref="Dependency"/>s.</exception> /// <exception cref="ImplementationNotFoundException">One of the <see cref="Store.Model.Implementation"/>s is not cached yet.</exception> /// <exception cref="ExecutorException"><see cref="ExecutableInPath.Name"/> is invalid.</exception> /// <exception cref="IOException">A problem occurred while writing the file.</exception> /// <exception cref="UnauthorizedAccessException">Write access to the file is not permitted.</exception> private void ApplyExecutableInPath(ExecutableInPath binding, ImplementationSelection implementation, ProcessStartInfo startInfo) { Log.Debug("Applying " + binding + " for " + implementation); if (string.IsNullOrEmpty(binding.Name)) throw new ExecutorException(string.Format(Resources.MissingBindingName, @"<executable-in-path>")); if (Path.GetInvalidFileNameChars().Any(invalidChar => binding.Name.Contains(invalidChar.ToString(CultureInfo.InvariantCulture)))) throw new ExecutorException(string.Format(Resources.IllegalCharInBindingName, @"<executable-in-path>")); string exePath = DeployRunEnvExecutable(binding.Name); // Add executable directory to PATH variable startInfo.EnvironmentVariables["PATH"] = Path.GetDirectoryName(exePath) + Path.PathSeparator + startInfo.EnvironmentVariables["PATH"]; // Tell the executable what command-line to run _runEnvPendings.Add(new RunEnvPending(binding.Name, GetCommandLine(implementation, binding.Command ?? Command.NameRun, startInfo))); }