From 9ffdbb2c6dc03237bba9bf0d26d4b67e73c90f0d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Tue, 9 Feb 2021 21:22:56 -0800 Subject: [PATCH] Take two --- SabreTools/Features/Extract.cs | 5 +++-- SabreTools/Features/Restore.cs | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/SabreTools/Features/Extract.cs b/SabreTools/Features/Extract.cs index 5d1e8a16..ce4912fe 100644 --- a/SabreTools/Features/Extract.cs +++ b/SabreTools/Features/Extract.cs @@ -65,8 +65,9 @@ The following systems have headers that this program can work with: /// True if the output file was created, false otherwise private bool DetectTransformStore(string file, string outDir, bool nostore) { - // Ensure the output directory - outDir = outDir.Ensure(); + // Create the output directory if it doesn't exist + if (!string.IsNullOrWhiteSpace(outDir) && !Directory.Exists(outDir)) + Directory.CreateDirectory(outDir); logger.User($"\nGetting skipper information for '{file}'"); diff --git a/SabreTools/Features/Restore.cs b/SabreTools/Features/Restore.cs index a4ff0bce..9b797cd8 100644 --- a/SabreTools/Features/Restore.cs +++ b/SabreTools/Features/Restore.cs @@ -59,8 +59,9 @@ The following systems have headers that this program can work with: /// True if a header was found and appended, false otherwise public bool RestoreHeader(string file, string outDir) { - // Ensure the output directory - outDir = outDir.Ensure(); + // Create the output directory if it doesn't exist + if (!string.IsNullOrWhiteSpace(outDir) && !Directory.Exists(outDir)) + Directory.CreateDirectory(outDir); // First, get the SHA-1 hash of the file BaseFile baseFile = BaseFile.GetInfo(file, hashes: Hash.SHA1, asFiles: TreatAsFile.NonArchive);