diff --git a/src/AppInstallerCLICore/Workflows/DownloadFlow.cpp b/src/AppInstallerCLICore/Workflows/DownloadFlow.cpp index 307851bfa3..be853966df 100644 --- a/src/AppInstallerCLICore/Workflows/DownloadFlow.cpp +++ b/src/AppInstallerCLICore/Workflows/DownloadFlow.cpp @@ -149,6 +149,17 @@ namespace AppInstaller::CLI::Workflow try { std::filesystem::remove(path); + + // It is assumed that the parent of the installer path will always be a directory + // If it isn't, then something went severely wrong. However, we will check that + // it is a directory here just to be safe. If it is an empty directory, remove it + + if (std::filesystem::is_directory(path.parent_path()) && + std::filesystem::is_empty(path.parent_path()) + ) + { + std::filesystem::remove(path.parent_path()); + } } catch (const std::exception& e) {