Skip to content

Commit a9e313a

Browse files
committed
[FlashpointManager] Remove redundant path verification code
1 parent 47d3ff5 commit a9e313a

3 files changed

Lines changed: 4 additions & 16 deletions

File tree

FlashpointManager/src/Common.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -456,15 +456,15 @@ public static void DeleteFileAndDirectories(string file)
456456
}
457457

458458
// Checks if specified Flashpoint source path is valid
459-
public static bool VerifySourcePath()
459+
public static bool VerifySourcePath(string sourcePath)
460460
{
461461
bool isFlashpoint = false;
462462

463463
IterateXML(XmlTree.GetElementsByTagName("list")[0].ChildNodes, node =>
464464
{
465465
if (isFlashpoint || node.Name != "component") return;
466466

467-
if (new Component(node).Downloaded)
467+
if (File.Exists(Path.Combine(sourcePath, "Components", new Component(node).ID)))
468468
{
469469
isFlashpoint = true;
470470
}

FlashpointManager/src/Forms/Settings.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,7 @@ private void BrowseButton_Click(object sender, EventArgs e)
1818

1919
if (pathDialog.ShowDialog() == CommonFileDialogResult.Ok)
2020
{
21-
bool isFlashpoint = false;
22-
23-
FPM.IterateXML(FPM.XmlTree.GetElementsByTagName("list")[0].ChildNodes, node =>
24-
{
25-
if (isFlashpoint || node.Name != "component") return;
26-
27-
if (File.Exists(Path.Combine(pathDialog.FileName, "Components", new Component(node).ID)))
28-
{
29-
isFlashpoint = true;
30-
}
31-
});
32-
33-
if (isFlashpoint)
21+
if (FPM.VerifySourcePath(pathDialog.FileName))
3422
{
3523
LocationBox.Text = pathDialog.FileName;
3624
}

FlashpointManager/src/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static void Main(string[] args)
129129
}
130130

131131
// Verify that the configured Flashpoint path is valid
132-
while (!FPM.VerifySourcePath())
132+
while (!FPM.VerifySourcePath(FPM.SourcePath))
133133
{
134134
FPM.GenericError(
135135
"The Flashpoint directory specified in fpm.cfg is invalid!\n\n" +

0 commit comments

Comments
 (0)