From: sr55 Date: Sat, 12 Jan 2019 19:56:08 +0000 (+0000) Subject: WinGui: Make the MRU feature more useful. If the directory is not found, check to... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a8013555230c715d3011aca4422c96f76137b672;p=handbrake WinGui: Make the MRU feature more useful. If the directory is not found, check to see if the Parent directory exists. #1795 --- diff --git a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs index 54da681dc..13396a676 100644 --- a/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs +++ b/win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs @@ -10,6 +10,7 @@ namespace HandBrakeWPF.ViewModels { using System; + using System.Diagnostics; using System.IO; using Caliburn.Micro; @@ -94,6 +95,23 @@ namespace HandBrakeWPF.ViewModels return filePath; } + // Check if the parent directory still exists. + if (!string.IsNullOrEmpty(filePath) ) + { + try + { + DirectoryInfo parentDirectory = Directory.GetParent(filePath); + if (parentDirectory != null && filePath.Contains(parentDirectory.FullName)) + { + return parentDirectory.FullName; + } + } + catch (Exception exc) + { + Debug.WriteLine(exc); + } + } + return null; }