Skip to content

Commit 0c85cb6

Browse files
committed
a few final fixes for user errors.
1 parent 2b5d864 commit 0c85cb6

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

FolderSync/SyncLogic.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ public void RunInitialSync()
1616
throw new DirectoryNotFoundException($"Source folder '{Config.SourceFolder}' no longer exists");
1717
if(!Directory.Exists(Config.BackupFolder))
1818
throw new DirectoryNotFoundException($"Backup folder '{Config.BackupFolder}' no longer exists");
19-
if(!Directory.Exists(Config.LogFilePath))
19+
if (!Directory.Exists(Directory.GetParent(Config.LogFilePath).ToString()))
2020
throw new DirectoryNotFoundException($"Log file path '{Config.LogFilePath}' no longer exists");
21+
if(!File.Exists(Config.LogFilePath))
22+
throw new FileNotFoundException($"Log file '{Config.LogFilePath}' no longer exists");
2123

2224
CheckForMissingDirs();
2325
CheckForDeletedFiles();
@@ -34,8 +36,10 @@ public void RunSyncLoop()
3436
throw new DirectoryNotFoundException($"Source folder '{Config.SourceFolder}' no longer exists");
3537
if(!Directory.Exists(Config.BackupFolder))
3638
throw new DirectoryNotFoundException($"Backup folder '{Config.BackupFolder}' no longer exists");
37-
if(!Directory.Exists(Config.LogFilePath))
39+
if (!Directory.Exists(Directory.GetParent(Config.LogFilePath).ToString()))
3840
throw new DirectoryNotFoundException($"Log file path '{Config.LogFilePath}' no longer exists");
41+
if(!File.Exists(Config.LogFilePath))
42+
throw new FileNotFoundException($"Log file '{Config.LogFilePath}' no longer exists");
3943
CheckForMissingDirs();
4044
CheckForModifiedFiles();
4145
CheckForCopiesInSource();

0 commit comments

Comments
 (0)