]> granicus.if.org Git - handbrake/commitdiff
WinGui: Make the MRU feature more useful. If the directory is not found, check to...
authorsr55 <sr55.hb@outlook.com>
Sat, 12 Jan 2019 19:56:08 +0000 (19:56 +0000)
committersr55 <sr55.hb@outlook.com>
Sat, 12 Jan 2019 19:56:08 +0000 (19:56 +0000)
win/CS/HandBrakeWPF/ViewModels/ViewModelBase.cs

index 54da681dccee917275b042fbe2be31c45dab8be1..13396a6765c893bca1cea514d53d867ad59eaf66 100644 (file)
@@ -10,6 +10,7 @@
 namespace HandBrakeWPF.ViewModels\r
 {\r
     using System;\r
+    using System.Diagnostics;\r
     using System.IO;\r
 \r
     using Caliburn.Micro;\r
@@ -94,6 +95,23 @@ namespace HandBrakeWPF.ViewModels
                 return filePath;\r
             }\r
 \r
+            // Check if the parent directory still exists.\r
+            if (!string.IsNullOrEmpty(filePath) )\r
+            {\r
+                try\r
+                {\r
+                    DirectoryInfo parentDirectory = Directory.GetParent(filePath);\r
+                    if (parentDirectory != null && filePath.Contains(parentDirectory.FullName))\r
+                    {\r
+                        return parentDirectory.FullName;\r
+                    }\r
+                }\r
+                catch (Exception exc)\r
+                {\r
+                    Debug.WriteLine(exc);\r
+                }\r
+            }\r
+\r
             return null;\r
         }\r
 \r