From 7949e2e18232f2925d5cee258e52e5282e59e6b6 Mon Sep 17 00:00:00 2001 From: Adam Sturge Date: Fri, 15 Jan 2016 19:14:59 -0800 Subject: [PATCH] Added Directory.Exists check for Movie director when clicking the browse button --- BizHawk.Client.EmuHawk/movie/RecordMovie.cs | 24 +++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/BizHawk.Client.EmuHawk/movie/RecordMovie.cs b/BizHawk.Client.EmuHawk/movie/RecordMovie.cs index fb8fdfc849..323ac13b61 100644 --- a/BizHawk.Client.EmuHawk/movie/RecordMovie.cs +++ b/BizHawk.Client.EmuHawk/movie/RecordMovie.cs @@ -150,10 +150,30 @@ namespace BizHawk.Client.EmuHawk } private void BrowseBtn_Click(object sender, EventArgs e) - { + { + string movieFolderPath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null); + + // Create movie folder if it doesn't already exist + try + { + if (!Directory.Exists(movieFolderPath)) + { + Directory.CreateDirectory(movieFolderPath); + } + } + catch (Exception movieDirException) + when ( + movieDirException is IOException || + movieDirException is UnauthorizedAccessException || + movieDirException is PathTooLongException + ) + { + + } + var sfd = new SaveFileDialog { - InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null), + InitialDirectory = movieFolderPath, DefaultExt = "." + Global.MovieSession.Movie.PreferredExtension, FileName = RecordBox.Text, OverwritePrompt = false,