Skip to content

Commit 06f168d

Browse files
committed
Check for missing folders.
#366 (comment)
1 parent 706ff78 commit 06f168d

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Scripts/DowloadPortalItemData.swift

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -230,17 +230,18 @@ var downloadedItems = previousDownloadedItems
230230

231231
await withTaskGroup(of: Void.self) { group in
232232
for portalItem in portalItems {
233-
// Checks to see if an item is already downloaded.
234-
guard downloadedItems[portalItem.identifier] == nil else {
235-
print("note: Item already downloaded: \(portalItem.identifier)")
236-
continue
237-
}
238-
239233
let destinationURL = downloadDirectoryURL.appendingPathComponent(
240234
portalItem.identifier,
241235
isDirectory: true
242236
)
243237

238+
// Checks to see if an item needs downloading.
239+
guard downloadedItems[portalItem.identifier] == nil ||
240+
!FileManager.default.fileExists(atPath: destinationURL.path) else {
241+
print("note: Item already downloaded: \(portalItem.identifier)")
242+
continue
243+
}
244+
244245
// Deletes the directory when the item is not in the plist.
245246
try? FileManager.default.removeItem(at: destinationURL)
246247

0 commit comments

Comments
 (0)