/// <summary> /// Prints the specified local resource path. /// </summary> /// <param name="resourceName"> Specified resource name</param> /// <param name="path"> Path for the specified resource</param> private void PrintLocalResourcePath(string resourceName, string path, LocalsArgs localsArgs) { if (string.IsNullOrWhiteSpace(path)) { localsArgs.LogError(string.Format(CultureInfo.CurrentCulture, Strings.LocalsCommand_LocalResourcePathNotSet)); } else { localsArgs.LogInformation(string.Format(CultureInfo.CurrentCulture, $"{resourceName}: {path}")); } }
/// <summary> /// Recursively deletes the specified directory tree. /// </summary> /// <param name="folderPath">Specified directory to be deleted</param> /// <returns><code>True</code> if the operation was successful; otherwise <code>false</code>.</returns> private bool ClearCacheDirectory(string folderPath, LocalsArgs localsArgs) { // In order to get detailed error messages, we need to do recursion ourselves. var failedDeletes = new List <string>(); LocalResourceUtils.DeleteDirectoryTree(folderPath, failedDeletes); if (failedDeletes.Any()) { localsArgs.LogInformation(string.Format(CultureInfo.CurrentCulture, Strings.LocalsCommand_LocalsPartiallyCleared)); foreach (var failedDelete in failedDeletes.OrderBy(f => f, StringComparer.OrdinalIgnoreCase)) { localsArgs.LogError(string.Format(CultureInfo.CurrentCulture, Strings.LocalsCommand_FailedToDeletePath, failedDelete)); } return(false); } else { return(true); } }