Skip to content

Commit 1ec3cba

Browse files
author
Connor Moreside
committed
Fix bug where application still has open connections to SQLite3 db. Fix bug found in manage copybook view.
1 parent bb54bec commit 1ec3cba

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

CodeMovement.EbcdicCompare.App/App.xaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<Application x:Class="CodeMovement.EbcdicCompare.App.App"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
xmlns:local="clr-namespace:CodeMovement.EbcdicCompare.App">
4+
xmlns:local="clr-namespace:CodeMovement.EbcdicCompare.App"
5+
Exit="Application_Exit">
56
<Application.Resources>
67
<Style x:Key="LinkButton" TargetType="Button" BasedOn="{StaticResource ResourceKey={x:Type Button}}">
78
<Setter Property="Width" Value="Auto"/>
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Configuration;
4-
using System.Data;
5-
using System.Linq;
6-
using System.Threading.Tasks;
7-
using System.Windows;
1+
using System.Windows;
82

93
namespace CodeMovement.EbcdicCompare.App
104
{
@@ -18,5 +12,11 @@ protected override void OnStartup(StartupEventArgs e)
1812
var bootstrapper = new Bootstrapper();
1913
bootstrapper.Run();
2014
}
15+
16+
private void Application_Exit(object sender, ExitEventArgs e)
17+
{
18+
// Ensure that all SQLiteConnections are closed.
19+
System.Data.SQLite.SQLiteConnection.ClearAllPools();
20+
}
2121
}
2222
}

CodeMovement.EbcdicCompare.Services/FileOperationsManager.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,10 @@ public OperationResult<string> CopyFile(string fromPath, string toPath)
6565
try
6666
{
6767
var fileName = Path.GetFileName(fromPath);
68-
var newToPath = Path.Combine(toPath, fileName);
68+
var newToPath = Path.GetFullPath(Path.Combine(toPath, fileName));
6969

70-
_fileOperation.Copy(fromPath, newToPath, true);
70+
if (fromPath != newToPath)
71+
_fileOperation.Copy(fromPath, newToPath, true);
7172

7273
result.Result = newToPath;
7374
}

0 commit comments

Comments
 (0)