Skip to content

Commit e484eee

Browse files
AdamSturgeAdamSturge
AdamSturge
authored and
AdamSturge
committed
Merge pull request #1 from AdamSturge/feature/create-movie-path
Feature/create movie path
2 parents d786292 + 2f11a3a commit e484eee

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

BizHawk.Client.EmuHawk/movie/RecordMovie.cs

+22-2
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,30 @@ private void Cancel_Click(object sender, EventArgs e)
150150
}
151151

152152
private void BrowseBtn_Click(object sender, EventArgs e)
153-
{
153+
{
154+
string movieFolderPath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null);
155+
156+
// Create movie folder if it doesn't already exist
157+
try
158+
{
159+
if (!Directory.Exists(movieFolderPath))
160+
{
161+
Directory.CreateDirectory(movieFolderPath);
162+
}
163+
}
164+
catch (Exception movieDirException)
165+
when (
166+
movieDirException is IOException ||
167+
movieDirException is UnauthorizedAccessException ||
168+
movieDirException is PathTooLongException
169+
)
170+
{
171+
//TO DO : Pass error to user?
172+
}
173+
154174
var sfd = new SaveFileDialog
155175
{
156-
InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null),
176+
InitialDirectory = movieFolderPath,
157177
DefaultExt = "." + Global.MovieSession.Movie.PreferredExtension,
158178
FileName = RecordBox.Text,
159179
OverwritePrompt = false,

0 commit comments

Comments
 (0)