From f3d48d42f46644795c5a35bf117edaeefe496ca3 Mon Sep 17 00:00:00 2001 From: sr55 Date: Wed, 27 Apr 2011 19:40:41 +0000 Subject: WinGui: - Automatically attempt to create destination path if it does not exist when starting an encode. - When adding to queue, it'll optionally ask. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3962 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/CS/frmMain.cs | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'win/CS/frmMain.cs') diff --git a/win/CS/frmMain.cs b/win/CS/frmMain.cs index 51678516b..5c82fd2c9 100644 --- a/win/CS/frmMain.cs +++ b/win/CS/frmMain.cs @@ -1113,9 +1113,32 @@ namespace Handbrake if (!Directory.Exists(Path.GetDirectoryName(jobDestination))) { if (showError) - MessageBox.Show(string.Format("Destination Path does not exist.\nPath: {0}\n\nThis item was not added to the Queue.", Path.GetDirectoryName(jobDestination)), "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); + { + DialogResult result = + MessageBox.Show( + string.Format("Destination Path does not exist.\nPath: {0}\n\n Would you like to create it now?", Path.GetDirectoryName(jobDestination)), + "Warning", + MessageBoxButtons.YesNo, + MessageBoxIcon.Question); + + if (result == DialogResult.Yes) + { + // Make sure the path exists, attempt to create it if it doesn't + string path = Directory.GetParent(jobDestination).ToString(); + if (!Directory.Exists(path)) + { + Directory.CreateDirectory(path); + } + } + else + { + return false; + } + } + return false; } + // Make sure we don't have a duplciate on the queue. if (this.queueProcessor.QueueManager.CheckForDestinationPathDuplicates(jobDestination)) -- cgit v1.2.3