Inline single-use DirPath variables and move CreateDirectory calls next to their write sites

Co-authored-by: Tyrrrz <1935960+Tyrrrz@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Tyrrrz/DiscordChatExporter/sessions/73520af9-6314-464f-ae0f-1bb63f1d1105
This commit is contained in:
copilot-swe-agent[bot] 2026-03-23 18:05:26 +00:00
parent 48685802cd
commit 8a4cb05d02

View file

@ -35,17 +35,16 @@ public class PublishMacOSBundleCommand : ICommand
var bundleName = "DiscordChatExporter.app";
var bundleDirPath = Path.Combine(tempDirPath, bundleName);
var contentsDirPath = Path.Combine(bundleDirPath, "Contents");
var macosDirPath = Path.Combine(contentsDirPath, "MacOS");
var resourcesDirPath = Path.Combine(contentsDirPath, "Resources");
try
{
// Initialize the bundle's directory structure
Directory.CreateDirectory(macosDirPath);
Directory.CreateDirectory(resourcesDirPath);
// Copy icons into the .app's Resources folder
File.Copy(IconsFilePath, Path.Combine(resourcesDirPath, "AppIcon.icns"), true);
Directory.CreateDirectory(Path.Combine(contentsDirPath, "Resources"));
File.Copy(
IconsFilePath,
Path.Combine(contentsDirPath, "Resources", "AppIcon.icns"),
true
);
// Generate the Info.plist metadata file with the app information
// lang=xml
@ -90,9 +89,10 @@ public class PublishMacOSBundleCommand : ICommand
Directory.Delete(existingBundlePath, true);
// Move all files from the publish directory into the MacOS directory
Directory.CreateDirectory(Path.Combine(contentsDirPath, "MacOS"));
foreach (var entry in Directory.GetFileSystemEntries(publishDirPath))
{
var destination = Path.Combine(macosDirPath, Path.GetFileName(entry));
var destination = Path.Combine(contentsDirPath, "MacOS", Path.GetFileName(entry));
if (Directory.Exists(entry))
Directory.Move(entry, destination);
else