From 59ce93bbc06c2c900412d081bb75f05515050bec Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Tue, 15 Sep 2020 21:56:10 -0400 Subject: [PATCH] add some duplicate filtering when adding a disk image to the recent list. --- Ample/DiskImagesWindowController.m | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Ample/DiskImagesWindowController.m b/Ample/DiskImagesWindowController.m index f727d6f..0fc0311 100644 --- a/Ample/DiskImagesWindowController.m +++ b/Ample/DiskImagesWindowController.m @@ -108,6 +108,19 @@ // todo -- check if file is in the list already... + BOOL found = NO; + // should really compare the volume id / ino I suppose. + for (NSMutableDictionary *d in _content) { + NSString *s = [d objectForKey: @"path"]; + if ([path compare: s] == NSOrderedSame) { + found = YES; + [d setObject: [NSDate new] forKey: @"date"]; + _dirty = YES; // ? + break; + } + } + if (found) return NO; + NSFileManager *fm = [NSFileManager defaultManager]; NSError *error;