Esempio n. 1
0
        /// <summary>
        /// If applicable, ensure tools exist and are
        /// in an expected state.
        /// </summary>
        public void TestTools()
        {
            // Ensure tools have been downloaded on Windows.
            if (this.isWindowsOs)
            {
                // Resolve tools path directory.
                string toolsPath = Paths.BaseDirectory(this.options.ToolsPath);

                // Inform the user of the tools path being used.
                Log.Verbose($"Using tools directory: {toolsPath}");

                // Tools directory must exist on Windows.
                if (!Directory.Exists(toolsPath))
                {
                    Log.Error("Tools directory does not exist. You may have a corrupt installation.");
                }

                // Ensure all tools exist.
                foreach ((ToolType type, ToolDefinition tool) in ToolConstants.Tools)
                {
                    // Ensure required properties are set.
                    if (String.IsNullOrEmpty(tool.FileName))
                    {
                        throw new Exception($"Tool definition for '{type}' must contain a filename.");
                    }

                    // Resolve the path for the tool.
                    string path = this.options.PathResolver.Tool(type);

                    // Ensure tool exists.
                    if (!File.Exists(path))
                    {
                        Log.Error($"Required tool executable '{path}' is missing. You may have a corrupt installation.");
                    }
                }

                // Do not continue at this point.
                return;
            }
        }