Skip to content

Commit

Permalink
Modified file name error
Browse files Browse the repository at this point in the history
  • Loading branch information
AMagistroni committed Sep 7, 2021
1 parent 7e2edaf commit 570b50f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions SqlSchemaCompare.WindowsForm/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ private void BtnCreateUpdateFile_Click(object sender, EventArgs e)
if (File.Exists(txtUpdateSchemaFile.Text))
File.Delete(txtUpdateSchemaFile.Text);

var errorFile = GetErrorFileName();
var errorFile = GetErrorFileName("_errorsUpdateSchema");
if (File.Exists(errorFile))
File.Delete(errorFile);

Expand All @@ -251,11 +251,11 @@ private void BtnCreateUpdateFile_Click(object sender, EventArgs e)
}
}

private string GetErrorFileName()
private string GetErrorFileName(string suffix)
{
var indexDot = txtUpdateSchemaFile.Text.LastIndexOf('.');
if (indexDot > 0)
return $"{txtUpdateSchemaFile.Text.Substring(0, indexDot)}_errorsUpdateSchema.{txtUpdateSchemaFile.Text.Substring(indexDot + 1)}";
return $"{txtUpdateSchemaFile.Text.Substring(0, indexDot)}{suffix}.{txtUpdateSchemaFile.Text.Substring(indexDot + 1)}";
else
return $"{txtUpdateSchemaFile.Text}_errors";
}
Expand All @@ -276,7 +276,7 @@ private void BtnLoadSchema_Click(object sender, EventArgs e)
if (!MandatoryFieldArePresent())
return;

var errorFile = GetErrorFileName();
var errorFile = GetErrorFileName("_errorsLoadSchema");
if (File.Exists(errorFile))
File.Delete(errorFile);

Expand Down

0 comments on commit 570b50f

Please sign in to comment.