From 360c05c2c878266013b5dc1a768f3c2f133cb46e Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 11 May 2014 19:00:44 +0000 Subject: [PATCH] Dual GB XML Creator - if file already exists, ask before overwriting --- BizHawk.Client.EmuHawk/tools/GB/DualGBXMLCreator.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/BizHawk.Client.EmuHawk/tools/GB/DualGBXMLCreator.cs b/BizHawk.Client.EmuHawk/tools/GB/DualGBXMLCreator.cs index 849dd947f4..e8296ec453 100644 --- a/BizHawk.Client.EmuHawk/tools/GB/DualGBXMLCreator.cs +++ b/BizHawk.Client.EmuHawk/tools/GB/DualGBXMLCreator.cs @@ -152,6 +152,16 @@ namespace BizHawk.Client.EmuHawk { if (Recalculate()) { + var fileInfo = new FileInfo(textBoxOutputDir.Text); + + if (fileInfo.Exists) + { + var result = MessageBox.Show(this, "File already exists, overwrite?", "File exists", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning); + if (result != DialogResult.OK) + { + return; + } + } using (var sw = new StreamWriter(textBoxOutputDir.Text)) { sw.Write(textBoxXML.Text);