summaryrefslogtreecommitdiffstats
path: root/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
diff options
context:
space:
mode:
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs')
-rw-r--r--win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs27
1 files changed, 27 insertions, 0 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
index ecaafeeb2..ca9558175 100644
--- a/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
+++ b/win/CS/HandBrake.ApplicationServices/Services/Base/EncodeBase.cs
@@ -336,6 +336,33 @@ namespace HandBrake.ApplicationServices.Services.Base
}
}
+ /// <summary>
+ /// Verify the Encode Destination path exists and if not, create it.
+ /// </summary>
+ /// <param name="task">
+ /// The task.
+ /// </param>
+ /// <exception cref="Exception">
+ /// If the creation fails, an exception is thrown.
+ /// </exception>
+ protected void VerifyEncodeDestinationPath(QueueTask task)
+ {
+ // Make sure the path exists, attempt to create it if it doesn't
+ string path = Directory.GetParent(task.Destination).ToString();
+ if (!Directory.Exists(path))
+ {
+ try
+ {
+ Directory.CreateDirectory(path);
+ }
+ catch (Exception)
+ {
+ throw new Exception(
+ "Unable to create directory for the encoded output. Please verify the drive and path is correct.");
+ }
+ }
+ }
+
#endregion
}
} \ No newline at end of file