Skip to content

Commit

Permalink
Update cache command to handle directories
Browse files Browse the repository at this point in the history
  • Loading branch information
mdanish-kh committed Apr 13, 2023
1 parent 65352cd commit bd0545f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/WingetCreateCLI/Commands/CacheCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@ public override Task<bool> Execute()
file.Delete();
}

Console.WriteLine();
var directories = dir.GetDirectories();
Logger.InfoLocalized(nameof(Resources.DirectoriesFound_Message), directories.Length, PackageParser.InstallerDownloadPath);
Console.WriteLine();

foreach (DirectoryInfo directory in directories)
{
Logger.WarnLocalized(nameof(Resources.DeletingInstaller_Message), directory.Name + Path.DirectorySeparatorChar);
directory.Delete(true);
}

Console.WriteLine();
Logger.InfoLocalized(nameof(Resources.InstallerCacheCleaned_Message));
}
Expand All @@ -82,6 +93,15 @@ public override Task<bool> Execute()
{
Logger.Debug(Path.GetFileName(file));
}

Console.WriteLine();
string[] directories = Directory.GetDirectories(PackageParser.InstallerDownloadPath);
Logger.InfoLocalized(nameof(Resources.DirectoriesFound_Message), directories.Length, PackageParser.InstallerDownloadPath);
Console.WriteLine();
foreach (string directory in directories)
{
Logger.Debug(Path.GetRelativePath(PackageParser.InstallerDownloadPath, directory) + Path.DirectorySeparatorChar);
}
}
else if (this.Open)
{
Expand Down
13 changes: 12 additions & 1 deletion src/WingetCreateCLI/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions src/WingetCreateCLI/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,11 @@
<data name="Description_KeywordDescription" xml:space="preserve">
<value>The full package description</value>
</data>
<data name="DirectoriesFound_Message" xml:space="preserve">
<value>{0} directories found in {1}</value>
<comment>{0} - Will be replaced with the number of installers found in the cache folder
{1} - Will be replaced with the path to the downloaded installer cache folder</comment>
</data>
<data name="DoneSymbol_String" xml:space="preserve">
<value>DONE</value>
</data>
Expand Down

0 comments on commit bd0545f

Please sign in to comment.