Skip to content

Commit 567b035

Browse files
committed
Show better error message if backup directory doesn't exist
1 parent 659e186 commit 567b035

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

source/BulkCrapUninstaller/Forms/Windows/JunkRemoveWindow.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ private void buttonAccept_Click(object sender, EventArgs e)
142142
private void CreateBackup(string backupPath)
143143
{
144144
var dir = Path.Combine(backupPath, GetUniqueBackupName());
145+
if (string.IsNullOrEmpty(backupPath) || !Directory.Exists(backupPath))
146+
{
147+
PremadeDialogs.GenericError($"The parent directory does not exist:\n{backupPath}\n\nPlease choose a different backup location.");
148+
throw new OperationCanceledException();
149+
}
145150
try
146151
{
147152
Directory.CreateDirectory(dir);
@@ -367,7 +372,7 @@ private void RunBackup(string targetdir)
367372
if (failed.Any())
368373
{
369374
failed.Sort();
370-
375+
371376
// Prevent the dialog from getting too large
372377
if (failed.Count > 6) failed = failed.Take(5).Concat(new[] { "... (check log for the full list)" }).ToList();
373378

0 commit comments

Comments
 (0)