Skip to content

Commit 1aa4eb8

Browse files
committed
[FlashpointInstaller] Display warning if destination path already contains files
1 parent f0dce86 commit 1aa4eb8

File tree

1 file changed

+14
-1
lines changed
  • FlashpointInstaller/src/Forms

1 file changed

+14
-1
lines changed

FlashpointInstaller/src/Forms/Main.cs

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Diagnostics;
33
using System.IO;
4+
using System.Linq;
45
using System.Windows.Forms;
56
using System.Xml;
67

@@ -117,12 +118,24 @@ private void InstallButton_Click(object sender, EventArgs e)
117118
{
118119
if (!FPM.VerifyDestinationPath(DestinationPath.Text) || !FPM.CheckDependencies()) return;
119120

121+
if (Directory.Exists(DestinationPath.Text) && Directory.EnumerateFileSystemEntries(DestinationPath.Text).Any())
122+
{
123+
var pathDialog = MessageBox.Show(
124+
"There are already files in the specified path.\n\n" +
125+
"If you uninstall Flashpoint, these files will be deleted as well.\n\n" +
126+
"Are you sure you want to continue?",
127+
"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning
128+
);
129+
130+
if (pathDialog == DialogResult.No) return;
131+
}
132+
120133
if (DestinationPath.Text.Length >= 192)
121134
{
122135
var pathDialog = MessageBox.Show(
123136
"The specified path is extremely long. This may cause certain functionality to break.\n\n" +
124137
"Are you sure you want to continue?",
125-
"Error", MessageBoxButtons.YesNo, MessageBoxIcon.Warning
138+
"Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning
126139
);
127140

128141
if (pathDialog == DialogResult.No) return;

0 commit comments

Comments
 (0)