From 6fd372279c7cd07cfb99b79f95719d20067ec9d4 Mon Sep 17 00:00:00 2001 From: Ben Moxon Date: Fri, 22 Oct 2021 18:04:13 +0100 Subject: [PATCH] Some path related fixes There were problems with a new clone being executed. This resolves them and ensures the "Downloaded" folder is created on first run if it didn't exist already. --- MCS-Extractor/FirstRunWindow.xaml.cs | 11 +++++++++++ MCS-Extractor/MCS-Extractor.csproj | 28 ++++++++++++++-------------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/MCS-Extractor/FirstRunWindow.xaml.cs b/MCS-Extractor/FirstRunWindow.xaml.cs index 395f7ab..d707210 100644 --- a/MCS-Extractor/FirstRunWindow.xaml.cs +++ b/MCS-Extractor/FirstRunWindow.xaml.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -56,6 +57,7 @@ await Task.Run(() => { result = OdbcCreation.CreateODBC(String.Format("{0};Database={1}", ConfigurationManager.AppSettings["ConnectionString"], ConfigurationManager.AppSettings["DatabaseName"])); } + CheckForDataDirectory(); } if (result) { @@ -76,5 +78,14 @@ await Task.Run(() => } }); } + + private void CheckForDataDirectory() + { + var datadir = System.IO.Path.Combine(CSVFileHandler.GetInstallFolder(), ConfigurationManager.AppSettings["DataDirectory"]); + if ( !Directory.Exists(datadir)) + { + Directory.CreateDirectory(datadir); + } + } } } diff --git a/MCS-Extractor/MCS-Extractor.csproj b/MCS-Extractor/MCS-Extractor.csproj index 0c2fd47..6fd6e1d 100644 --- a/MCS-Extractor/MCS-Extractor.csproj +++ b/MCS-Extractor/MCS-Extractor.csproj @@ -54,51 +54,51 @@ - packages\CsvHelper.27.1.1\lib\net47\CsvHelper.dll + ..\packages\CsvHelper.27.1.1\lib\net47\CsvHelper.dll - packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll + ..\packages\Microsoft.Bcl.AsyncInterfaces.5.0.0\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll - packages\Microsoft.Bcl.HashCode.1.1.1\lib\net461\Microsoft.Bcl.HashCode.dll + ..\packages\Microsoft.Bcl.HashCode.1.1.1\lib\net461\Microsoft.Bcl.HashCode.dll - packages\Npgsql.5.0.7\lib\netstandard2.0\Npgsql.dll + ..\packages\Npgsql.5.0.7\lib\netstandard2.0\Npgsql.dll - packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll + ..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll - packages\Microsoft.PowerShell.5.ReferenceAssemblies.1.1.0\lib\net4\System.Management.Automation.dll + ..\packages\Microsoft.PowerShell.5.ReferenceAssemblies.1.1.0\lib\net4\System.Management.Automation.dll True - packages\System.Memory.4.5.4\lib\net461\System.Memory.dll + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll - packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll + ..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll - packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll + ..\packages\System.Runtime.CompilerServices.Unsafe.4.6.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll - packages\System.Text.Encodings.Web.4.6.0\lib\netstandard2.0\System.Text.Encodings.Web.dll + ..\packages\System.Text.Encodings.Web.4.6.0\lib\netstandard2.0\System.Text.Encodings.Web.dll - packages\System.Text.Json.4.6.0\lib\net461\System.Text.Json.dll + ..\packages\System.Text.Json.4.6.0\lib\net461\System.Text.Json.dll - packages\System.Threading.Channels.4.7.0\lib\netstandard2.0\System.Threading.Channels.dll + ..\packages\System.Threading.Channels.4.7.0\lib\netstandard2.0\System.Threading.Channels.dll - packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll + ..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll - packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll True