示例#1
0
        /// <summary>
        /// This method takes the path to the intended location of the CDK deployment project and performs validations on it.
        /// </summary>
        /// <param name="saveCdkDirectoryPath">Relative or absolute path of the directory at which the CDK deployment project will be saved.</param>
        /// <returns>A tuple containaing a boolean that indicates if the directory is valid and a corresponding string error message.</returns>
        private Tuple <bool, string> ValidateSaveCdkDirectory(string saveCdkDirectoryPath)
        {
            var errorMessage = string.Empty;
            var isValid      = true;
            var targetApplicationDirectoryFullPath = _directoryManager.GetDirectoryInfo(_targetApplicationFullPath).Parent.FullName;

            if (!_directoryManager.IsEmpty(saveCdkDirectoryPath))
            {
                errorMessage += "The directory specified for saving the CDK project is non-empty. " +
                                "Please provide an empty directory path and try again." + Environment.NewLine;

                isValid = false;
            }
            if (_directoryManager.ExistsInsideDirectory(targetApplicationDirectoryFullPath, saveCdkDirectoryPath))
            {
                errorMessage += "The directory used to save the CDK deployment project is contained inside of " +
                                "the target application project directory. Please specify a different directory and try again.";

                isValid = false;
            }

            return(new Tuple <bool, string>(isValid, errorMessage.Trim()));
        }