diff --git a/README.md b/README.md index 3b73d27..30a61ed 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,6 @@ Attached to the Release you'll find a `CsvProc9000-vX_X_X.zip` which contains: Before running `CreateService.bat` you should make sure that your configuration is the way you want it to be. If there are any issues with starting the service, check out the log-file that is generated in the location where the `CsvProc9000.exe` is, in the folder `logs`. Common issues are: - Forgot to configure the Inbox/Outbox folders -- Inbox folder does not exist ## 🖱️ Update diff --git a/src/CsvProc9000/CsvProc9000.csproj b/src/CsvProc9000/CsvProc9000.csproj index 7dacc85..2372512 100644 --- a/src/CsvProc9000/CsvProc9000.csproj +++ b/src/CsvProc9000/CsvProc9000.csproj @@ -2,7 +2,6 @@ net5.0 - dotnet-CsvProc9000-055DDDC9-859F-42E2-A255-DB243F7D73A6 diff --git a/src/CsvProc9000/Processors/CsvProcessor.cs b/src/CsvProc9000/Processors/CsvProcessor.cs index 862d61b..5986ff8 100644 --- a/src/CsvProc9000/Processors/CsvProcessor.cs +++ b/src/CsvProc9000/Processors/CsvProcessor.cs @@ -84,7 +84,7 @@ private async Task SaveResultAsync(IFileSystemInfo file, CsvFile csvFile) _logger.LogInformation("Processor: Saving result to {Destination}...", destinationFileName); - if (_fileSystem.Directory.Exists(_processorOptions.Outbox)) + if (!_fileSystem.Directory.Exists(_processorOptions.Outbox)) _fileSystem.Directory.CreateDirectory(_processorOptions.Outbox); await _saveCsvFile.SaveToAsync(csvFile, destinationFileName, _processorOptions.OutboxDelimiter); @@ -127,4 +127,4 @@ private bool IsFileLocked(IFileSystemInfo file) } } } -} \ No newline at end of file +} diff --git a/src/CsvProc9000/Workers/CsvWatcherWorker.cs b/src/CsvProc9000/Workers/CsvWatcherWorker.cs index 04b2c8e..0e63ff1 100644 --- a/src/CsvProc9000/Workers/CsvWatcherWorker.cs +++ b/src/CsvProc9000/Workers/CsvWatcherWorker.cs @@ -39,6 +39,9 @@ public CsvWatcherWorker( protected override Task ExecuteAsync(CancellationToken stoppingToken) { + if (!_fileSystem.Directory.Exists(_processorOptions.Inbox)) + _fileSystem.Directory.CreateDirectory(_processorOptions.Inbox); + _logger.LogInformation("Watcher: Starting to watch for files in {Target}...", _processorOptions.Inbox); _fileSystemWatcher.EnableRaisingEvents = true; @@ -80,4 +83,4 @@ private void OnFileCreated(object sender, FileSystemEventArgs eventArgs) _csvProcessor.ProcessAsync(file).WaitAndUnwrapException(); } } -} \ No newline at end of file +}