Skip to content

Commit

Permalink
Added a check to make sure the Launcher isn't in the chosen Doom RPG …
Browse files Browse the repository at this point in the history
…folder so it doesn't try to delete itself
  • Loading branch information
Kyle873 committed Apr 6, 2014
1 parent b66312c commit 1014e03
Showing 1 changed file with 25 additions and 9 deletions.
34 changes: 25 additions & 9 deletions Utilities/Doom RPG Launcher/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,27 +32,34 @@ public FormMain()
config.Load();

// Populate dynamic controls
PopulateComboBoxes();

// Load Controls
LoadControls();

// Mods
PopulateMods();

// send initial events to specific controls to refresh their states
richTextBoxCredits_TextChanged(null, null);
}

private void PopulateComboBoxes()
{
// IWAD
for (int i = 0; i < Enum.GetNames(typeof(IWAD)).Length; i++)
comboBoxIWAD.Items.Add(Enum.GetName(typeof(IWAD), i));
comboBoxIWAD.SelectedIndex = (int)config.iwad;

// Difficulty
for (int i = 0; i < Enum.GetNames(typeof(Difficulty)).Length; i++)
comboBoxDifficulty.Items.Add(Enum.GetName(typeof(Difficulty), i));
comboBoxDifficulty.SelectedIndex = (int)config.difficulty;

// DRLA Class
for (int i = 0; i < Enum.GetNames(typeof(DRLAClass)).Length; i++)
comboBoxClass.Items.Add(Enum.GetName(typeof(DRLAClass), i));
comboBoxClass.SelectedIndex = (int)config.rlClass;

// Load Controls
LoadControls();

// Mods
PopulateMods();

// send initial events to specific controls to refresh their states
richTextBoxCredits_TextChanged(null, null);
}

private void PopulateMods()
Expand Down Expand Up @@ -83,22 +90,31 @@ private bool CheckForErrors()
Utils.ShowError("You must specify a source port path!");
return false;
}

if (config.DRPGPath == string.Empty)
{
Utils.ShowError("You must specify Doom RPG's path!");
return false;
}

if (config.modsPath == string.Empty && (config.patches[3] == true || config.patches[4] == true || config.patches[5] == true))
{
Utils.ShowError("You must specify a WAD/PK3 path for the selected patches!");
return false;
}

if (Path.GetDirectoryName(config.portPath) == config.DRPGPath)
{
Utils.ShowError("The Port Path and Doom RPG path cannot be the same!");
return false;
}

if (config.DRPGPath == Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))
{
Utils.ShowError("You cannot keep the launcher within the Doom RPG folder! Please move it to a different location.");
return false;
}

return true;
}

Expand Down

0 comments on commit 1014e03

Please sign in to comment.