Skip to content

Commit d83c22e

Browse files
committed
Ensure that only files are synchronised during initial synchronisation.
1 parent 02ff51b commit d83c22e

File tree

1 file changed

+12
-31
lines changed

1 file changed

+12
-31
lines changed

Program.cs

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -182,44 +182,25 @@ private static async Task MainTask()
182182

183183

184184
//1. Do initial synchronisation from sync to async folder //TODO: config for enabling and ordering of this operation
185-
foreach (var fileSystemInfo in new DirectoryInfo(Global.SyncPath)
186-
.GetFileSystemInfos("*." + Global.WatchedCodeExtension, SearchOption.AllDirectories))
185+
foreach (var fileInfo in new DirectoryInfo(Global.SyncPath)
186+
.GetFiles("*." + Global.WatchedCodeExtension, SearchOption.AllDirectories))
187187
{
188-
await ConsoleWatch.OnAddedAsync
189-
(
190-
new DummyFileSystemEvent(fileSystemInfo),
191-
new CancellationToken()
192-
);
193-
}
194-
195-
foreach (var fileSystemInfo in new DirectoryInfo(Global.SyncPath)
196-
.GetFileSystemInfos("*." + Global.WatchedResXExtension, SearchOption.AllDirectories))
197-
{
198-
await ConsoleWatch.OnAddedAsync
199-
(
200-
new DummyFileSystemEvent(fileSystemInfo),
201-
new CancellationToken()
202-
);
188+
{
189+
await ConsoleWatch.OnAddedAsync
190+
(
191+
new DummyFileSystemEvent(fileInfo),
192+
new CancellationToken()
193+
);
194+
}
203195
}
204196

205-
206197
//2. Do initial synchronisation from async to sync folder //TODO: config for enabling and ordering of this operation
207-
foreach (var fileSystemInfo in new DirectoryInfo(Global.AsyncPath)
208-
.GetFileSystemInfos("*." + Global.WatchedCodeExtension, SearchOption.AllDirectories))
209-
{
210-
await ConsoleWatch.OnAddedAsync
211-
(
212-
new DummyFileSystemEvent(fileSystemInfo),
213-
new CancellationToken()
214-
);
215-
}
216-
217-
foreach (var fileSystemInfo in new DirectoryInfo(Global.AsyncPath)
218-
.GetFileSystemInfos("*." + Global.WatchedResXExtension, SearchOption.AllDirectories))
198+
foreach (var fileInfo in new DirectoryInfo(Global.AsyncPath)
199+
.GetFiles("*." + Global.WatchedCodeExtension, SearchOption.AllDirectories))
219200
{
220201
await ConsoleWatch.OnAddedAsync
221202
(
222-
new DummyFileSystemEvent(fileSystemInfo),
203+
new DummyFileSystemEvent(fileInfo),
223204
new CancellationToken()
224205
);
225206
}

0 commit comments

Comments
 (0)