MatchPath
This commit is contained in:
parent
c1a4eb4808
commit
0d6af37f89
@ -7,6 +7,7 @@ public record AppSettings(string BuildNumber,
|
||||
string Company,
|
||||
string Destination,
|
||||
string GitCommitSeven,
|
||||
bool MatchPath,
|
||||
int MillisecondsDelay,
|
||||
string WatchDirectory)
|
||||
{
|
||||
|
@ -10,6 +10,7 @@ public class AppSettings
|
||||
public string? Company { get; set; }
|
||||
public string? Destination { get; set; }
|
||||
public string? GitCommitSeven { get; set; }
|
||||
public bool? MatchPath { get; set; }
|
||||
public int? MillisecondsDelay { get; set; }
|
||||
public string? WatchDirectory { get; set; }
|
||||
|
||||
@ -27,12 +28,14 @@ public class AppSettings
|
||||
if (appSettings.Company is null) throw new NullReferenceException(nameof(Company));
|
||||
if (appSettings.Destination is null) throw new NullReferenceException(nameof(Destination));
|
||||
if (appSettings.GitCommitSeven is null) throw new NullReferenceException(nameof(GitCommitSeven));
|
||||
if (appSettings.MatchPath is null) throw new NullReferenceException(nameof(MatchPath));
|
||||
if (appSettings.MillisecondsDelay is null) throw new NullReferenceException(nameof(MillisecondsDelay));
|
||||
if (appSettings.WatchDirectory is null) throw new NullReferenceException(nameof(WatchDirectory));
|
||||
result = new(appSettings.BuildNumber,
|
||||
appSettings.Company,
|
||||
appSettings.Destination,
|
||||
appSettings.GitCommitSeven,
|
||||
appSettings.MatchPath.Value,
|
||||
appSettings.MillisecondsDelay.Value,
|
||||
appSettings.WatchDirectory);
|
||||
return result;
|
||||
|
@ -37,7 +37,7 @@ public partial class Worker : BackgroundService
|
||||
string[] directories = Directory.GetDirectories(_AppSettings.WatchDirectory, "*", SearchOption.TopDirectoryOnly);
|
||||
foreach (string directory in directories)
|
||||
{
|
||||
checkDirectory = Path.Combine(_AppSettings.Destination, Path.GetFileName(directory));
|
||||
checkDirectory = !_AppSettings.MatchPath ? _AppSettings.Destination : Path.Combine(_AppSettings.Destination, Path.GetFileName(directory));
|
||||
try
|
||||
{
|
||||
if (!Directory.Exists(checkDirectory))
|
||||
|
Loading…
x
Reference in New Issue
Block a user